If anyOf
with type
array is used in a response, the generated code uses wrong imports:
import { Array<ImageDTO> } from '../model/models'; import { Array<ImageFileDTO> } from '../model/models';openapi-generator version
5.1.0
OpenAPI declaration file content or urlDefining the following schema
in a response:
"schema": { "title": "Get Content", "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/ImageFile" } }, { "type": "array", "items": { "$ref": "#/components/schemas/Image" } } ] }
leads to the following import statements, which try to import the array type:
import { Array<ImageDTO> } from '../model/models'; import { Array<ImageFileDTO> } from '../model/models';
Correctly only ImageDTO
and ImageFileDTO
should be imported.
java -jar openapi-generator-cli-5.1.0.jar generate -i openapi\minimal_openapi.json -g typescript-angular -o .\src\client --additional-properties=modelSuffix=DTO
Wrapping the anyOf
in a schema which is used as response does not lead to this issue.
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