-
Notifications
You must be signed in to change notification settings - Fork 295
Description
Describe the bug
Server variables can be persisted between schemas, leading to url corruption.
Expected behavior
Server variables for a schema should not be overwritten by those from a different schema.
Current behavior
Viewing the docs for a schema will lead to the server variables being persisted in the browsers' sessionStorage. Viewing the docs for a different schema with the same server url will cause the persisted server variables to be used, instead of those from the current schema. This results in malformed urls being shown in the docs, code samples, and request panel.
Possible solution
If the authPersistence configuration option were implemented, it would be possible to disable persistence of the server variables, which would satisfy our use case.
Alternatively, currently only a single instance of server variables is persisted in sessionStorage. If this were to be keyed by schema somehow, it could avoid leaking server variables between schemas.
Steps to reproduce
Minimal reproduction is available at tayles@ed11dec
Schema 1 has this server definition:
servers:
- url: https://my-api.com/{path}
variables:
path:
default: schema-1-path
description: A path variableSchema 2 has this server definition:
servers:
- url: https://my-api.com/{path}
variables:
path:
default: schema-2-path
description: A different path variable- View the docs for Schema 1
- View the docs for Schema 2
- See URL corruption in constructed endpoint urls, code samples, and request panel, e.g.
https://my-api.com/schema-1-path/schema-2-endpoint
Screenshots
Context
We have multiple services which are published under the same base url. For example:
https://{region}.{environment}.my-api.com/service-1https://{region}.{environment}.my-api.com/service-2
These both share the same base url of https://{region}.{environment}.my-api.com/{service}, with a server variable used to provide the service name/path.
Your Environment
- Version used: v4.5.1