swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.33k stars 8.92k forks source link

Swagger UI is ignoring OpenAPI-spec query parameter #8041

Open peteole opened 2 years ago

peteole commented 2 years ago

Hi, I am having the issue that when deploying the swagger ui with multiple OpenAPI-specs (so that you need the dropdown menu on the top to select the spec) the query parameter marking the selection in the address bar is totally ignored. The API specs load perfectly and also reflect the selected spec in the address, but when I reload the page the viewer switches back to the first API spec, even though the address bar still indicates another spec should be displayed. Also sharing links to a specific spec does not work due to the issue, however the URL hash works correctly so that the viewer jumps to the right operation of a spec after reload

This issue occurs with the latest docker image, setting the list of loadable specs with a config file URL.

peteole commented 2 years ago

By the way my configuration is the following in kubernetes:

...
    spec:
      containers:
      - name: swagger-ui
        image: docker.io/swaggerapi/swagger-ui:latest
        imagePullPolicy: Always
        env:
        - name: BASE_URL
          value: /doc/swagger-ui
        - name: CONFIG_URL
          value: https://my-config-url.com
        - name: DEEP_LINKING
          value: 'true'
        - name: FILTER
          value: 'true'
        - name: PERSIST_AUTHORIZATION
          value: 'true'
        ports:
        - name: swagger-ui
          containerPort: 8080

So the DEEP_LINKING=true works for the first API spec only, but it does not enable me to link a specific operation in a API spec.

Tri0L commented 1 year ago

@peteole add QUERY_CONFIG_ENABLED: "true" to config.