Skip to content

Error with comments when using $ref: ExampleElement value and externalValue fields are mutually exclusive. #10418

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

Open
mclei-asw opened this issue Apr 17, 2025 · 1 comment

Comments

@mclei-asw
Copy link

Q&A (please complete the following information)

  • OS: Debian 12
  • Browser: Chrome
  • Version: 133
  • Method of installation: dist folder
  • Swagger-UI version: 5.20.8
  • Swagger/OpenAPI version: OpenAPI 3.1.0

Content & configuration

index.yaml

openapi: 3.1.0
info:
  title: 'Bug test'
  version: 1.0.0

servers:
  - url: /bug

paths:
  /test:
    $ref: test.yaml

test.yaml:

post:
  responses:
    '200':
      content:
        application/json:
          examples:
            testExample:
              summary: Test example
              externalValue: test.json

test.json:

{}

Describe the bug you're encountering

This configuration with $ref used in path is throwing Error:

Resolver error at post.responses.200.content.application/json.examples.testExample.externalValue
Could not resolve reference: ExampleElement value and externalValue fields are mutually exclusive.

When there is no $ref used and the content of test.yaml is directly included in the main index.yaml, no error occurs.

To reproduce...

Just open this definition in UI.

Expected behavior

This error should not occur as the definition is exactly the same. The difference is just the $ref. The $ref is supported under particular paths in OpenAPI 3.

@char0n
Copy link
Member

char0n commented Apr 17, 2025

Hi @mclei-asw,

I need to reproduce for myself, but yes, from what you're describing and looking at your API Description, the error shouldn't be triggered.

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

No branches or pull requests

3 participants