OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[x] Have you provided a full/minimal spec to reproduce the issue?
[x] Have you validated the input using an OpenAPI validator (example)?
[x] What's the version of OpenAPI Generator used?
[x] Have you search for related issues/PRs?
[x] What's the actual output vs expected output?
[ ] [Optional] Bounty to sponsor the fix (example)
Description
The generated type of an array that is nested within another array is erased to the "Any" type. The type is well defined in the OAPI declaration, and should be reflected in the generated code.
This issue does not happen for objects in array unless that array is within another array.
The issue also does not occur when the nested object type of specified via $ref. Examples provided.
Bug Report Checklist
Description
The generated type of an array that is nested within another array is erased to the "Any" type. The type is well defined in the OAPI declaration, and should be reflected in the generated code.
This issue does not happen for objects in array unless that array is within another array.
The issue also does not occur when the nested object type of specified via
$ref
. Examples provided.openapi-generator version
master (4.3.0-SNAPSHOT)
OpenAPI declaration file content or url
Command line used for generation
java -jar openapi-generator-cli.jar generate -g kotlin -i spec.yaml -o gen
(also fails for Swift and probably any typed languge)
Steps to reproduce
spec.yaml
& run the example command-linecat gen/src/main/kotlin/org/openapitools/client/models/InlineResponse200.kt
kotlin.Any
inner type:$ref
, the inner type isMyObj
:Desired output:
Either
MyObj
or a generated inline model. It should just not beAny
.Related issues/PRs
n/a
Suggest a fix
The code used to introspect the properties of arrays should respect for nested child arrays. I have not been able to figure out a fix for this yet.