Skip to content

Commit d0b5a9c

Browse files
authored
Added Server Object JSON examples.
Enhanced Server Object YAML examples with JSON examples to be consistent with remainder of document.
1 parent 0b75783 commit d0b5a9c

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

versions/3.0.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,39 @@ This object can be extended with [Specification Extensions](#specificationExtens
338338

339339
A single server would be described as:
340340

341+
```json
342+
{
343+
"url": "https://development.gigantic-server.com/v1",
344+
"description": "Development server"
345+
}
346+
```
347+
341348
```yaml
342349
url: https://development.gigantic-server.com/v1
343350
description: Development server
344351
```
345352

346353
The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oasServers):
347354

355+
```json
356+
{
357+
"servers": [
358+
{
359+
"url": "https://development.gigantic-server.com/v1",
360+
"description": "Development server"
361+
},
362+
{
363+
"url": "https://staging.gigantic-server.com/v1",
364+
"description": "Staging server"
365+
},
366+
{
367+
"url": "https://api.gigantic-server.com/v1",
368+
"description": "Production server"
369+
}
370+
]
371+
}
372+
```
373+
348374
```yaml
349375
servers:
350376
- url: https://development.gigantic-server.com/v1
@@ -357,6 +383,33 @@ servers:
357383

358384
The following shows how variables can be used for a server configuration:
359385

386+
```json
387+
{
388+
"servers": [
389+
{
390+
"url": "https://{username}.gigantic-server.com:{port}/{basePath}",
391+
"description": "The production API server",
392+
"variables": {
393+
"username": {
394+
"default": "demo",
395+
"description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
396+
},
397+
"port": {
398+
"enum": [
399+
8443,
400+
443
401+
],
402+
"default": 8443
403+
},
404+
"basePath": {
405+
"default": "v2"
406+
}
407+
}
408+
}
409+
]
410+
}
411+
```
412+
360413
```yaml
361414
servers:
362415
- url: https://{username}.gigantic-server.com:{port}/{basePath}

0 commit comments

Comments
 (0)