Skip to content

Externally defined subtypes are not resolved when referenced through the root #970

@ErikGrimes

Description

@ErikGrimes

Given the setup below, the parser only resolves Animal and AnimalFarmEntry. The parser should also resolve Cat and Dog.

api.yaml

openapi: 3.0.0
info:
  title: Sample API
  description: API description in Markdown.
  version: 1.0.0
paths:
  /farm:
    get:
      summary: Get the animal farm.
      description: Optional extended description in Markdown.
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: 'schema.yaml#/components/schemas/AnimalFarm'

schema.yaml

components:
  schemas:
    Dog:
      allOf:
        - $ref: '#/components/schemas/Animal'
        - type: object
          properties:
            breed:
              type: string
    Cat:
      allOf:
        - $ref: '#/components/schemas/Animal'
        - type: object
          properties:
            breed:
              type: string
    Animal:
      type: object
      discriminator:
        propertyName: className
      required:
        - className
      properties:
        className:
          type: string
        color:
          type: string
          default: red
    AnimalFarm:
      type: array
      items:
        $ref: '#/components/schemas/AnimalFarmEntry'
    AnimalFarmEntry:
      type: object
      properties:
        animal:
          $ref: "#/components/schemas/Animal"

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