Kotlin generation is producing a wrong parameter type for an enum that is declared in an array. It is getting the type from another array declared in the same object
openapi-generator version4.2.3
OpenAPI declaration file content or urlopenapi: 3.0.0 info: description: Blah version: v2 paths: /api/v2/query: post: operationId: foo requestBody: content: application/json: schema: $ref: "#/components/schemas/Query" components: schemas: Query: type: object properties: groupBy: type: array items: type: string enum: - value1 - value2 - value3 - value4 views: type: array items: type: intCommand line used for generation
openapi-generator generate -i test.yml -g kotlin --skip-validate-spec -o output
Steps to reproduceYou will see this code:
enum class GroupBy(val value: Int){ @Json(name = "value1") value1("value1"), @Json(name = "value2") value2("value2"), @Json(name = "value3") value3("value3"), @Json(name = "value4") value4("value4"); }
The Int parameter type here is not correct and will not compile. It should be kotlin.String. That type is coming from the views array type. If you change the type used for the views array it changes the GroupBy parameter type. If you remove the views property it does generate the correct code.
nickbw2003, grEvenX and mattbroekhuis
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4