Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching between OpenAPI versions breaks allOf behavior #5420

Open
Mivexil opened this issue Mar 20, 2025 · 0 comments
Open

Switching between OpenAPI versions breaks allOf behavior #5420

Mivexil opened this issue Mar 20, 2025 · 0 comments

Comments

@Mivexil
Copy link

Mivexil commented Mar 20, 2025

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Microsoft Edge
  • Version: 134
  • Method of installation: web (editor-next.swagger.io)
  • Swagger-Editor version: 5.0.0-alpha.136
  • Swagger/OpenAPI version: OpenAPI 3.0/3.1

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.1.0
info:
  title: Sample API
  version: '0.1'
paths:
components:
  schemas:
    BasicErrorModel:
      type: object
      required:
        - message
        - code
      properties:
        message:
          type: string
        code:
          type: integer
          minimum: 100
          maximum: 600
    ExtendedErrorModel:
      allOf: # Combines the BasicErrorModel and the inline model
        - $ref: "#/components/schemas/BasicErrorModel"
        - type: object
          required:
            - rootCause
          properties:
            rootCause:
              type: string

Describe the bug you're encountering

Switching between OpenAPI 3.0 and 3.1 versions causes the allOf element to render improperly.

To reproduce...

Steps to reproduce the behavior:

  1. Open the Swagger Next editor, and paste the provided API definition. At this point the ExtendedErrorModel renders with a wrong type:

Image

but fixes itself upon opening it, showing expected behavior.

Image

  1. Keeping the model open, change the 3.1.0 in the first line to 3.0.0.
  2. Change the 3.0.0 in the first line to 3.1.0 again.

Expected behavior

The spec renders as it did in step 1. Instead, the ref is not rendered properly:

Image

Image

The model needs to be fully collapsed and re-opened to render properly.

Additional context or thoughts

While probably inconsequential, it is confusing - initially I thought the behavior of allOf has changed for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant