swagger-codegen
swagger-codegen copied to clipboard
Wrong generation with allOf if $ref is last
With this little change in test/resources/3_0_0/petstore.yaml
Dog:
allOf:
- type: object
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]
- $ref: '#/components/schemas/Pet'
Cat:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
hunts:
type: boolean
age:
type: integer
it generates
public class Cat extends Pet implements OneOfAllPetsResponseItems, OneOfSinglePetResponsePet {
but
public class Dog implements OneOfAllPetsResponseItems, OneOfSinglePetResponsePet {
Semantically, both are the same, so there is no reason for this difference. Same time, docs for this variant is generating fine.