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

OpenAPI 3.0: references defined in examples should not be dereferenced #10328

Open
char0n opened this issue Feb 28, 2025 · 0 comments
Open

OpenAPI 3.0: references defined in examples should not be dereferenced #10328

char0n opened this issue Feb 28, 2025 · 0 comments

Comments

@char0n
Copy link
Member

char0n commented Feb 28, 2025

When defining a reference inside of examples fields on various spec objects, instead of the Example Object, the reference should not be dereferenced.

For this specification:

  responses:
    ExampleResponse:
      description: An error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ExampleModel'
          examples:
            $ref: '#/components/examples/tshirt'
  examples:
    tshirt:
      summary: Sample T-shirt data
      value:
        # Example value starts here
        id: 17
        name: T-shirt
        description: 100% cotton shirt
        categories: [clothes]

when the example gets dereferenced, each field of tshirt will be seen as a separate example. Each of them will be rendered as an option for examples select:

Screenshot 2024-07-15 at 09 32 07

This does not happen for OpenAPI 3.1:

Screenshot 2024-07-15 at 12 43 53

Additional context or thoughts

To fix this, we need to utilise ApiDOM for OpenAPI 3.0.


Originally reported by @glowcloud

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