You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Openapi generator into kotlin-spring generates incorrect kotlin code when I use list (ZOO) of child objects (Cats or Dog) with the common inheritance parent (Pet) in the openapi definition. It creates a data class ZOOAnimalsInner with all fields required, does matter if it is field of Cat, Dog or Pet.
openapi-generator version
6.6.0
OpenAPI declaration file content or url
openapi: 3.0.0info:
version: 1.0.0title: allOf testdescription: based on https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/paths:
/zoo:
patch:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ZOO'responses:
'200':
description: Updatedcomponents:
schemas:
Pet:
type: objectrequired:
- pet_typeproperties:
pet_type:
type: stringdiscriminator:
propertyName: pet_typeDog: # "Dog" is a value for the pet_type property (the discriminator value)allOf: # Combines the main `Pet` schema with `Dog`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object# all other properties specific to a `Dog`required:
- bark
- breedproperties:
bark:
type: booleanbreed:
type: stringenum: [Dingo, Husky, Retriever, Shepherd]Cat: # "Cat" is a value for the pet_type property (the discriminator value)allOf: # Combines the main `Pet` schema with `Cat`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object# all other properties specific to a `Cat`required:
- hunts
- ageproperties:
hunts:
type: booleanage:
type: integerZOO:
type: objectproperties:
animals:
type: arrayitems:
oneOf:
- $ref: '#/components/schemas/Dog'
- $ref: '#/components/schemas/Cat'
Suggest a fix
Fields of Cat and fields of Dog shlould be optional in the generated class ZOOAnimalsInner.
The text was updated successfully, but these errors were encountered:
Description
Openapi generator into kotlin-spring generates incorrect kotlin code when I use list (ZOO) of child objects (Cats or Dog) with the common inheritance parent (Pet) in the openapi definition. It creates a data class ZOOAnimalsInner with all fields required, does matter if it is field of Cat, Dog or Pet.
openapi-generator version
6.6.0
OpenAPI declaration file content or url
Suggest a fix
Fields of Cat and fields of Dog shlould be optional in the generated class ZOOAnimalsInner.
The text was updated successfully, but these errors were encountered: