Skip to content

Commit 9e1ff6b

Browse files
committed
feat: adds a name field to the server object
Signed-off-by: Vincent Biret <[email protected]>
1 parent ac2fde4 commit 9e1ff6b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/oas.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ An object representing a Server.
477477
| ---- | :----: | ---- |
478478
| <a name="server-url"></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 document containing the Server Object is being served. Variable substitutions will be made when a variable is named in `{`braces`}`. |
479479
| <a name="server-description"></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. |
480+
| <a name="server-name"></a>name | `string` | An optional unique string to refer to the host designated by the URL. |
480481
| <a name="server-variables"></a>variables | Map[`string`, [Server Variable Object](#server-variable-object)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. |
481482

482483
This object MAY be extended with [Specification Extensions](#specification-extensions).
@@ -488,13 +489,15 @@ A single server would be described as:
488489
```json
489490
{
490491
"url": "https://development.gigantic-server.com/v1",
491-
"description": "Development server"
492+
"description": "Development server",
493+
"name": "dev"
492494
}
493495
```
494496

495497
```yaml
496498
url: https://development.gigantic-server.com/v1
497499
description: Development server
500+
name: dev
498501
```
499502

500503
The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oas-servers):
@@ -504,15 +507,18 @@ The following shows how multiple servers can be described, for example, at the O
504507
"servers": [
505508
{
506509
"url": "https://development.gigantic-server.com/v1",
507-
"description": "Development server"
510+
"description": "Development server",
511+
"name": "dev"
508512
},
509513
{
510514
"url": "https://staging.gigantic-server.com/v1",
511-
"description": "Staging server"
515+
"description": "Staging server",
516+
"name": "staging"
512517
},
513518
{
514519
"url": "https://api.gigantic-server.com/v1",
515-
"description": "Production server"
520+
"description": "Production server",
521+
"name": "prod"
516522
}
517523
]
518524
}
@@ -522,10 +528,13 @@ The following shows how multiple servers can be described, for example, at the O
522528
servers:
523529
- url: https://development.gigantic-server.com/v1
524530
description: Development server
531+
name: dev
525532
- url: https://staging.gigantic-server.com/v1
526533
description: Staging server
534+
name: staging
527535
- url: https://api.gigantic-server.com/v1
528536
description: Production server
537+
name: prod
529538
```
530539

531540
The following shows how variables can be used for a server configuration:
@@ -536,6 +545,7 @@ The following shows how variables can be used for a server configuration:
536545
{
537546
"url": "https://{username}.gigantic-server.com:{port}/{basePath}",
538547
"description": "The production API server",
548+
"name": "prod",
539549
"variables": {
540550
"username": {
541551
"default": "demo",
@@ -558,6 +568,7 @@ The following shows how variables can be used for a server configuration:
558568
servers:
559569
- url: https://{username}.gigantic-server.com:{port}/{basePath}
560570
description: The production API server
571+
name: prod
561572
variables:
562573
username:
563574
# note! no enum here means it is an open value

0 commit comments

Comments
 (0)