You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FixesOAI#1675. Clarifies the language around server variables to make it clear that the API consumer, not the server, and not an unpecified poltergeist, is responsible for variable interpolation in all cases. The default value of a server variable is to by handled by the consumer (a.k.a. client), who will substitute that value into the URL template unless the client has a some alternative value assigned by user input, configuration, hard-coding, or whatever.
An object representing a single server or a group of servers sharing a common URL structure.
321
321
322
322
##### Fixed Fields
323
323
324
324
Field Name | Type | Description
325
325
---|:---:|---
326
-
<a name="serverUrl"></a>url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`.
326
+
<a name="serverUrl"></a>url | `string` | **REQUIRED**. A URL to the target host. This URL may include variable expressions, delimited by `{`curly braces`}`. Each variable expression MUST correspond to a [Server Variable Object](#serverVariableObject) named in the `variables` field, and the API consumer MUST replace each variable expression with a with a valid value, as specified by the corresponding Server Variable Object. The URL MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served.
327
327
<a name="serverDescription"></a>description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
328
-
<a name="serverVariables"></a>variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template.
328
+
<a name="serverVariables"></a>variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a server variable name and a Server Variable Object. Each server variable name SHOULD be referenced by a variable expression in the `url`.
329
329
330
330
This object MAY be extended with [Specification Extensions](#specificationExtensions).
331
331
@@ -387,7 +387,7 @@ The following shows how variables can be used for a server configuration:
387
387
"variables": {
388
388
"username": {
389
389
"default": "demo",
390
-
"description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
390
+
"description": "A user-specific subdomain provisioned for each account. Use `demo` for a free sandbox environment."
391
391
},
392
392
"port": {
393
393
"enum": [
@@ -413,7 +413,9 @@ servers:
413
413
username:
414
414
# note! no enum here means it is an open value
415
415
default: demo
416
-
description: this value is assigned by the service provider, in this example `gigantic-server.com`
416
+
description: |
417
+
A user-specific subdomain provisioned for each account.
An object representing a Server Variable for server URL template substitution.
432
+
An object representing a Server Variable for URL template substitution in a containing [Server Object](#serverObject).
433
+
434
+
To form an addressable server URL, the API consumer MUST substitute a valid value for each variable expression in the Server Object's `url` template. The API consumer MAY assign Server Variable values from user input, configuration settings, or any other source. If the API consumer does not have an assigned value for a given server variable, it MUST substitute the provided `default` value.
431
435
432
436
##### Fixed Fields
433
437
434
438
Field Name | Type | Description
435
439
---|:---:|---
436
-
<a name="serverVariableEnum"></a>enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. The array SHOULD NOT be empty.
437
-
<a name="serverVariableDefault"></a>default | `string` | **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schemaObject) treatment of default values, because in those cases parameter values are optional. If the [`enum`](#serverVariableEnum) is defined, the value SHOULD exist in the enum's values.
440
+
<a name="serverVariableEnum"></a>enum | [`string`] | An enumeration of valid string values for this variable. The array SHOULD NOT be empty. If `enum` is specified, the API consumer MUST assign one of enumerated values to the server variable.
441
+
<a name="serverVariableDefault"></a>default | `string` | **REQUIRED**. The default value for the server variable. If [`enum`](#serverVariableEnum) is defined, the `default` value SHOULD exist in the enum's values. If the API consumer does not have an alternative value, it MUST substitute the `default` value. Note that this behavior is different from the [Schema Object's](#schemaObject) treatment of default values. Schema defaults can be resolved by the server, and MAY be omitted from the request; but Server Variables MUST be resolved to an assigned or default value by the client, to assemble a final URL for the API request.
438
442
<a name="serverVariableDescription"></a>description | `string` | An optional description for the server variable. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
439
443
440
444
This object MAY be extended with [Specification Extensions](#specificationExtensions).
0 commit comments