Bug Report Checklist
Description
If I have a schema, that has a oneOf discriminator and a type:
components:
schemas:
Pet:
type: object
properties:
id:
type: string
minLength: 1
animal:
oneOf:
- $ref: '#/components/schemas/Dog'
- $ref: '#/components/schemas/Cat'
discriminator:
propertyName: type
mapping:
pet-dog: '#/components/schemas/Dog'
pet-cat: '#/components/schemas/Cat'
Dog:
type: object
properties:
type:
type: string
enum: ["pet-dog"]
default: "pet-dog"
imageId:
type: string
required:
- type
- imageId
Cat:
type: object
properties:
type:
type: string
enum: ["pet-cat"]
default: "pet-cat"
imageId:
type: string
style:
type: string
enum:
- "page"
- "text"
- "viewport"
required:
- type
- imageId
- style
The generated cobined class has a incorrect style allowed values in PetAnimal.php:
The following code is generated in
public const TYPE_PET_CAT = 'pet-cat';
public const TYPE_PET_DOG = 'pet-dog';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public static function getTypeAllowableValues()
{
return [
self::TYPE_PET_CAT,
self::TYPE_PET_DOG,
];
}
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public static function getStyleAllowableValues()
{
return [
self::TYPE_PET_CAT,
self::TYPE_PET_DOG,
];
}
openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
I make a test: https://github.com/coffeemakr/openapi-generator/tree/issues-23813
Related issues/PRs
Suggest a fix
Bug Report Checklist
Description
If I have a schema, that has a oneOf discriminator and a type:
The generated cobined class has a incorrect
styleallowed values in PetAnimal.php:The following code is generated in
openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
I make a test: https://github.com/coffeemakr/openapi-generator/tree/issues-23813
Related issues/PRs
Suggest a fix