Skip to content

Inline elements in allOf: array  #848

@jeff9finger

Description

@jeff9finger

I have been studying the open api spec and swagger-codegen projects for the constraints on allOf:

It appears that swagger-codegen (language is java) only recognizes the last inline element of an allOf: array. I have not found a statement in this spec or code in swagger-codegen that specifies this constraint.

So, I'm asking... Can the allOf: array be multiple inline elements? If I create a spec that has more than 1 inline element, it appears that only the last one is recognized.

FYI: This came up in trying to define a discriminator for the inline object.

Example:

definitions:

  Object:
    allOf:
      - $ref: '#/definitions/SomeOtherObject'
      - type: object
        discriminator: object_type0
        required:
          - object_type0
        properties:          
          object_type0:
            type: string
          name:
            type: string
      - type: object
        discriminator: object_type1
        required:
          - object_type1
        properties:          
          object_type1:
            type: string
          name:
            type: string

Is Object supposed to contain all the properties from both inline objects? And if so, how are the discriminator fields handled?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions