OpenAPITools / OpenAPITools/openapi-generator
[KOTLIN] Generator generates wrong data type
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
The data type of one property is completly wrong.
openapi-generator version
6.3.0
OpenAPI declaration file content or url
https://app-hsm-clse-stage.azurewebsites.net/swagger/standardV1/swagger.json
Command line used for generation
@echo off
:: https://openapi-generator.tech/docs/configuration#discovering-options
:: On Windows:
:: java -jar openapi-generator-cli.jar config-help -g kotlin
:: Additional properties, custom to the generator language are set with -p
:: https://openapi-generator.tech/docs/generators/kotlin
java -jar openapi-generator-cli.jar generate ^
--generator-name kotlin ^
--library jvm-retrofit2 ^
--input-spec "https://app-hsm-clse-stage.azurewebsites.net/swagger/standardV1/swagger.json" ^
--group-id com.hagleitner ^
--artifact-id hagleitner-hagi360api-client-kotlin ^
--artifact-version 1.0.0 ^
--invoker-package com.hagleitner.hagi360.networking ^
--package-name com.hagleitner.hagi360.networking ^
--model-package com.hagleitner.hagi360.networking.model ^
--api-package com.hagleitner.hagi360.networking.api ^
-p dateLibrary=java8 ^
-p java8=true ^
-p useRxJava3=true ^
-p moshiCodeGen=true ^
-p enumPropertyNaming=UPPERCASE ^
pause
Steps to reproduce
Run the batch file on Windows.
Check the file LatestResourceInstanceValueFilterDto
The last property is wrong:
@Json(name = "condition")
val condition: LatestResourceInstanceEquivalentValueFilterDtoCondition? = null
I don't know where the generator sees LatestResourceInstanceEquivalentValueFilterDtoCondition as being the type, when it is clear:
"condition": {
"oneOf": [
{
"$ref": "#/components/schemas/ClassifiedFilterConditionDto"
},
{
"$ref": "#/components/schemas/ExpressionedFilterConditionDto"
}
],
"nullable": true
}
},
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
Run the supplied Windows command against the linked OpenAPI declaration and inspect LatestResourceInstanceValueFilterDto. Compare the generated condition property with the declaration's oneOf references to ClassifiedFilterConditionDto and ExpressionedFilterConditionDto. Done means the Kotlin generator produces a type matching that schema instead of LatestResourceInstanceEquivalentValueFilterDtoCondition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100