java – Use openAPI 3.0 extends without using discriminator

Is it possible to have this generated by openAPI without using the discriminator? The reason is that I’m having a lot of trouble getting Jackson to serialize a json that does not have the discriminaotry value. So I wanted a workaround, and by having a simple class BaseClass, I can manually specify the type(I know it beforehand)

public abstract BaseClass{}

public Employee extends BaseClass {...}

This code below works but it uses discriminator and Jackson keep throwing property not found for the discriminator:

components:
  schemas:
    BaseClass:
      type: object
      required:
        - entityType
      properties:
        entityType:
          type: string
          enum:
            - Employee
      discriminator:
        propertyName: entityType

Employee:
  allOf:
    - $ref: "#/components/schemas/BaseClass"
  properties:
    anotherThing:
      type: string

OR is there a way for openPI to extend a class that has been defined in the classpath? Like I could manually define BaseClass in the src/java and have OpenAPI generate the Employee extends BaseClass thing

Read more here: Source link