swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Swagger urls.primaryName not working

Open janinko opened this issue 2 years ago • 4 comments

Q&A (please complete the following information)

  • OS: Fedora 35
  • Browser: Chrome
  • Version: 97.0.4692.99
  • Method of installation: docker
  • Swagger-UI version: 4.5.0
  • Swagger/OpenAPI version: OpenAPI 3.0.1

Content & configuration

Environment config:

      env:
         - name: URLS
           value: '[{url: "http://example.com/openapi.json", name: "orch"}, {url: "https://dev.example.com/openapi.json", name: "orch-DEV-master"}, {url: "http://stable.example.com/openapi.json", name: "orch-DEV-stable-next"}, {url: "http://stage.example.com/openapi.json", name: "orch-STAGE"}]'
/?urls.primaryName=orch-DEV-master

Describe the bug you're encountering

The urls.primaryName parameter is ignored when accessing the page and "orch" definition is always shown. Once the page loads, switching to different definition by the dropdown works as expected.

To reproduce...

Steps to reproduce the behavior:

  1. Go to '/?urls.primaryName=orch-DEV-master'
  2. See that definition orch is selected

Expected behavior

The definition should be selected according to the parameter in URL.

Screenshots

image

Additional context or thoughts

janinko avatar Feb 10 '22 10:02 janinko

Try add the parameter queryConfigEnabled: true

https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#core

sortbytes avatar Feb 20 '22 07:02 sortbytes

That helped, but doesn't that allow overriding all configuration options? Isn't that risky?

janinko avatar Mar 09 '22 13:03 janinko

That helped, but doesn't that allow overriding all configuration options? Isn't that risky?

See https://github.com/swagger-api/swagger-ui/security/advisories/GHSA-qrmm-w75w-3wpx

agusevas avatar Apr 12 '22 15:04 agusevas

Any updates on this? I think this is still an issue. You should be able to link to another internal definition without setting queryConfigEnabled: true, which enables linking to content from other sites.

Theoderich avatar Jul 11 '22 09:07 Theoderich