Allow defining multiple servers across multiple environments #55
fariadev22
started this conversation in
Ideas
Replies: 1 comment 6 replies
-
I'm not sure I follow what you mean by OpenAPI only allows defining environments across a single server. I like the idea of just using a named reference for redefining the server at the operation level. Have you seen this proposal? #50 It might help with your scenario |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem:
An API can have multiple servers involved e.g. the main server for API calls or servers related to OAuth 2.0 e.g. authorization server, token server, etc. Sometimes, some endpoints in the API may require a different server even though semantically they belong to the same API service.
And each of these servers can vary w.r.t. to the environment they are being called from e.g. the URLs of these servers can vary if the environment is production or sandbox.
Currently, OpenAPI allows defining multiple URLs across environments of a single server only. For OAuth 2.0 cases, since the OAuth servers are tied with the OAuth Flow Object as plain URLs, there is no way to specify their values across environments.
I work as an API specifications expert at APIMatic and we have encountered several users that run into such problems.
Suggested Solution
In APIMatic, we counter such cases by offering a server configuration vendor extension that allows you to specify values of multiple servers across multiple environments. There is a default environment and server to indicate what server will be used for all endpoints/OAuth by default unless they decide to override it.
Since each server has a name assigned to it, endpoints that require a different server (i.e. other than the default one) can override it by specifying its name explicitly.
In my opinion, having something similar in OpenAPI v4 could be quite useful.
Beta Was this translation helpful? Give feedback.
All reactions