OpenAPITools / OpenAPITools/openapi-generator
[BUG] Description when using oneOf, I get non-compiled code. Kotlin.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi-generator version
OpenAPI declaration file content or url
Generation Details
definitipns.yaml:
openapi: 3.0.0
info:
description: Fintech Risk Backend Antifraud System
title: Fintech Risk Backend Antifraud System
version: '1.0'
paths: { }
components:
schemas:
TestResponse:
oneOf:
- "$ref": "#/components/schemas/O1"
- "$ref": "#/components/schemas/O2"
- "$ref": "#/components/schemas/O3"
O1:
type: string
O2:
type: object
properties:
kek:
type: string
lol:
type: string
required:
- kek
- lol
O3:
type: array
items:
type: string
api.yaml:
openapi: 3.0.0
info:
description: Fintech Risk Backend Antifraud System
title: Fintech Risk Backend Antifraud System
version: '1.0'
paths:
/risk/calculation/status:
post:
description: |
Запрос на проверку завершения запроса
tags:
- test-client
operationId: test
responses:
'200':
description: Состояние заявки
content:
application/json:
schema:
'$ref': './definitions.yaml#/components/schemas/TestResponse'
/**
*
- @param kek
- @param lol
*/
data class O1 (
@field:JsonProperty("kek")
val kek: kotlin.String,
@field:JsonProperty("lol")
val lol: kotlin.String
):TestResponse
data class TestResponse (
@field:JsonProperty("kek")
val kek: kotlin.String,
@field:JsonProperty("lol")
val lol: kotlin.String
)
TestResponse is final. Don't implement.
Steps to reproduce
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce generation with the provided definitions.yaml and api.yaml, then inspect the generated Kotlin O1 and TestResponse declarations. Compare the oneOf schema with the output, focusing on why TestResponse is final and does not compile; done means the generated Kotlin for this specification compiles and correctly represents the alternatives.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100