Bug Report Checklist
Description
While using multiple inheritance the generated classes do not include the discriminator field. This mean the server is unable to select correct implementation for the abstract class.
openapi-generator version
4.2.1-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.0.2
info:
title: TEST
version: "1.0"
paths:
/test:
post:
operationId: test
responses:
200:
description: result
content:
'application/json':
schema:
type: array
items:
$ref: '#/components/schemas/AeItemVO'
components:
schemas:
AeItemVO:
required:
- itemTypeId
- textValue
type: object
properties:
id:
type: integer
format: int32
uuid:
type: string
itemTypeId:
type: integer
format: int32
itemSpecId:
type: integer
format: int32
textValue:
type: string
discriminator:
propertyName: '@class'
mapping:
AeItemInteger: '#/components/schemas/AeItemIntegerVO'
AeItemString: '#/components/schemas/AeItemStringVO'
AeItemIntegerVO:
allOf:
- $ref: '#/components/schemas/AeItemVO'
- type: object
properties:
value:
type: integer
format: int32
required:
- value
AeItemStringVO:
allOf:
- $ref: '#/components/schemas/AeItemVO'
- type: object
properties:
value:
type: string
required:
- value
Command line used for generation
openapi-generator generate -i openapi.yml -g typescript-axios -o src/api/generated/ -p withSeparateModelsAndApi=true,apiPackage=api,modelPackage=model
Steps to reproduce
run the above command.
The generated src/api/generated/model/ae-item-vo.ts contains
export interface AeItemVO {
id?: number;
uuid?: string;
itemTypeId: number;
itemSpecId?: number;
textValue: string;
}
expected output is
export interface AeItemVO {
'@class': string; // discriminator
id?: number;
uuid?: string;
itemTypeId: number;
itemSpecId?: number;
textValue: string;
}
Related issues/PRs
Suggest a fix
add missing functionality
Bug Report Checklist
Description
While using multiple inheritance the generated classes do not include the discriminator field. This mean the server is unable to select correct implementation for the abstract class.
openapi-generator version
4.2.1-SNAPSHOT
OpenAPI declaration file content or url
Command line used for generation
openapi-generator generate -i openapi.yml -g typescript-axios -o src/api/generated/ -p withSeparateModelsAndApi=true,apiPackage=api,modelPackage=modelSteps to reproduce
run the above command.
The generated
src/api/generated/model/ae-item-vo.tscontainsexpected output is
Related issues/PRs
Suggest a fix
add missing functionality