Skip to content

Rendering of references to properties depends on the order of clicks in the UI #10444

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
raskad opened this issue May 7, 2025 · 0 comments

Comments

@raskad
Copy link

raskad commented May 7, 2025

Q&A

  • OS: macOS
  • Browser: chrome
  • Version: 136
  • Method of installation: npm
  • Swagger-UI version: 5.21.0
  • Swagger/OpenAPI version: 3.0

Content & configuration

I have a minimal spec to reproduce this behaviour. The spec contains a schema (Test) that is referencing another schema (TestRef). TestRef contains two properties; value which is just a simple type and valueRef which is referencing value.
Based on the order in which I expand the schemas in the UI, the UI produces different results.

I noticed this behaviour when using the swagger-ui-react library, but it can also be observed on https://editor.swagger.io and https://editor-next.swagger.io/.

Example Swagger/OpenAPI definition:

openapi: 3.0.4
info:
  version: 0.0.1
  title: Test
  description: Test
paths: {}
components:
  schemas:
    Test:
      $ref: "#/components/schemas/TestRef"
    TestRef:
      type: object
      properties:
        value:
          type: number
        valueRef:
          $ref: "#/components/schemas/TestRef/properties/value"

Swagger-UI configuration options:

SwaggerUI({
  spec=`<insert spec from above>`
})

Describe the bug you're encountering

When clicking on Test, the value property is rendered correctly as a number. But the valueRef property is not rendered as a number but instead just displays the reference, e.g. https://editor.swagger.io/#/components/schemas/TestRef/properties/value.

When instead clicking on TestRef and then clicking on Test, both properties are correctly rendered as number.

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://editor.swagger.io
  2. Insert the example spec from above
  3. Reload the page
  4. Click on the schema Test
  5. Observe how valueRef is not rendered as a number
  6. Reload the page
  7. Click on the schema TestRef
  8. Click on the schema Test
  9. Observe how valueRef in rendered properly

Expected behavior

The behaviour of how refs are rendered should not depend on the order of clicks in the UI.

Screenshots

Behavior when clicking Test:
Click Test

Behavior when clicking TestRef and then Test:
Click TestRef then Test

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