Description
Note
A workaround for this issue has been found: #2832 (comment)
Package name
core
Package version
11.6.3
Reproduction steps
Open API Version: 3+
When generating a specification with an object containing an enum
with an allOf
, the definition of the Enum is not print in the generated Typescript file.
Example of specification:
{
"openapi": "3.0.2",
"info": {
"title": "Swagger Petstore - OpenAPI 3.0",
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0.19"
},
"servers": [
{
"url": "/api/v3"
}
],
"tags": [
{
"name": "pet",
"description": "Everything about your Pets",
}
],
"paths": {
"/pet/{petId}": {
"get": {
"tags": [
"pet"
],
"summary": "Find pet by ID",
"description": "Returns a single pet",
"operationId": "getPetById",
"parameters": [
{
"name": "petId",
"in": "path",
"description": "ID of pet to return",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"PartialPet": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"Pet": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/PartialPet"
}
],
"properties": {
"numberOfLegs": {
"type": "string",
"enum": [
"four",
"two"
]
}
}
}
}
}
}
Current result
export interface Pet {
name?: string;
numberOfLegs?: numberOfLegsEnum; // <- type not found
}
Expected result
export interface Pet {
name?: string;
numberOfLegs?: numberOfLegsEnum;
}
export type numberOfLegsEnum = 'two' | 'four';
Additional comments
No response