Replies: 4 comments 1 reply
|
OpenAPI does not currently define process or deployment environment variables. An OpenAPI Description defines the externally observable HTTP interface, so values such as If a value selects the API base URL, use servers:
- url: https://{environment}.example.com/v1
variables:
environment:
default: api
enum: [api, staging-api]That is URL-template substitution; it does not tell tooling to read an OS environment variable. If a value is actually sent over HTTP, describe it as a Parameter, Schema field, or Security Scheme as appropriate. A private machine-readable convention can use a namespaced specification extension such as If environments expose different contracts, separate descriptions or an OpenAPI Overlay may be clearer. The right representation therefore depends on whether the variable configures the server, a generated library, deployment, or an HTTP request. References: Server Variables, Specification Extensions, and Overlays. |
|
Hi @dfbustosus - Can you articulate the problem a bit better? For now, focus on Server variables. Not sure what problem you are trying to solve. |
|
i understand your post as an attempt at finding a middleground on existing solution and interpret it as implementation detail. personally i found environment variables separate to server variables as these can be deployment oriented. as the numbers of generators increase the differences between them can be an obstacle which would weigh on specification standards such as openapi is. the logical conclusion would be to lighten that burden by removing intention to specification. while the intention might be correct to presume the environment variables within the server variables, to me it seems distinguished enough to separate those two and make it easier for generators to adapt such salience faster. |
|
The distinction raised here by @bwdmr is an important one that repeatedly surfaces across SDK generators (such as OpenAPI Generator, Speakeasy, Fern, and Kiota). To keep the core specification clean and avoid specification bloat, it helps to understand why OAS maintains this separation and how the ecosystem standardizes this: 1. The Wire Contract Boundary vs. Client RuntimeThe OpenAPI Specification is intentionally scoped as a protocol wire contract—it strictly describes what passes over the wire (HTTP verbs, paths, headers, query params, request/response media types, and status codes). Process-level environment variables (like 2. How the Ecosystem Solves Generator Inconsistency TodayBecause SDK generators need a way to know which environment variable maps to an auth header or base URL without guessing:
Keeping host environment binding within Overlays or |
Uh oh!
There was an error while loading. Please reload this page.
environment variables need some way to be defined right?.
ideally some default definition of the same that would outline the scope of the library.
All reactions