Skip to content

[BUG] Spring generator: inheritance now always requires discriminator #9516

@AxelHeathnet

Description

@AxelHeathnet

According to the latest OAS3.0 specification the following is a perfect fine example of inheritance:

Animal:
      type: object
      properties:
        name:
          type: string
          
    Cat: 
      allOf:
      - $ref: '#/components/schemas/Animal'
      - type: object
        properties:
          breed:
            type: string

Till version 4.3.0 it works fine, the pojo is generated as:

public class Cat extends Animal{
  String breed;
}

From version 5.0.0 I instead get:

public class Cat {
  String name;
  String breed;
}

In order to make this work in version 5.0.x I have to edit the specification like this:

Animal:
      type: object
     discriminator:
       propertyName: className
      properties:
        name:
          type: string

Is this intentional? I find it much more confusing now

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions