Skip to content

OpenAPI 3.1.0: error when resolving schemas with allOf and circular references #3858

@glowcloud

Description

@glowcloud

NOTE: this will also be affecting ApiDOM OpenAPI 3.0.x dereferencing. Another issues needs to be create for ApiDOM repo.

Content & configuration

Swagger/OpenAPI definition:

openapi: 3.1.0
components:
  schemas:
    First:
      allOf:
        - $ref: '#/components/schemas/Second'
    Second:
      allOf:
        - $ref: '#/components/schemas/Third'
    Third:
      allOf:
        - $ref: '#/components/schemas/Second'

Describe the bug you're encountering

Resolving a subtree or the entire definition will cause an error TypeError: Elements in allOf must be objects.

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://editor-next.swagger.io/
  2. Paste the definition
  3. Open any of the schemas
  4. See the error

Screenshots

The result of opening Second and then Third schema:

Image

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