Open nicholaschiang opened 1 year ago
@nicholaschiang you need to wrap your two data types in oneOf
:
"items": {
"oneOf": [
{ "$ref": "#/components/schemas/Task" },
{ "$ref": "#/components/schemas/StarSchemaDataSource" }
]
},
Then you will get Array<Task | StarSchemaDataSource>
as the generated type.
Describe the bug When a response model is a tuple with two different data types (e.g.
[Task, StarSchemaDataSource]
), the generated code has anArray<any>
instead of[Task, StarSchemaDataSource]
.The OpenAPI spec:
The generated code:
The expected generated code:
Potentially related to #1885 (#1884).