Does Swagger UI retain the selected server across page reloads in embedded deployments?
0 reputation · 05 Sept 2020, 01:33 UTC
When an OpenAPI 3.x document defines multiple servers entries, Swagger UI renders them as a dropdown for "Try it out" requests. The first entry in the array is selected by default, yet the behavior after a user changes that selection and reloads the page varies across releases and embedding contexts.
Recent standalone Swagger UI distributions appear to persist the active server in browser local storage, whereas older versions or instances embedded in host applications with restricted storage may reset to the first entry on every load. Because local-storage access is not guaranteed in private browsing modes or sandboxed iframes, teams should verify persistence against the exact version bundled in their application rather than relying on general documentation.
Does the selected server survive a page reload in a given Swagger UI version, and what configuration or deployment factors determine whether local-storage persistence is available? Which behavior should teams expect when the same document is rendered in both a standalone distribution and an embedded iframe?