swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Wrong generation with allOf if $ref is last

Open inferrna opened this issue 2 years ago • 0 comments

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.

inferrna avatar Aug 28 '23 17:08 inferrna