This repository was archived by the owner on Dec 10, 2021. It is now read-only.
File tree 4 files changed +41
-4
lines changed
4 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ export class DefinitionGenerator {
42
42
version = uuid . v4 ( ) ,
43
43
models,
44
44
security,
45
- securitySchemes
45
+ securitySchemes,
46
+ servers
46
47
} = this . config ;
47
48
48
49
_ . merge ( this . definition , {
@@ -62,6 +63,10 @@ export class DefinitionGenerator {
62
63
this . definition . components . securitySchemes = securitySchemes ;
63
64
}
64
65
66
+ if ( servers ) {
67
+ this . definition . servers = servers ;
68
+ }
69
+
65
70
this . definition . components . schemas = await parseModels ( models , this . root ) ;
66
71
67
72
return this ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export interface DefinitionConfig {
16
16
version ?: string ;
17
17
securitySchemes : OpenAPIV3 . SecuritySchemeObject ;
18
18
security : Array < OpenAPIV3 . SecurityRequirementObject > ;
19
+ servers : Array < OpenAPIV3 . ServerObject > ;
19
20
models : Array < Model > ;
20
21
}
21
22
Original file line number Diff line number Diff line change @@ -196,9 +196,9 @@ components:
196
196
write : Grants write access
197
197
admin : Grants access to admin operations
198
198
info :
199
- title : ' '
199
+ title : Site API
200
200
description : ' '
201
- version : 6e48be1a-d9be-41ef-95eb-41ffad58eac3
201
+ version : v1.0.0
202
202
paths :
203
203
' /create/{username} ' :
204
204
post :
@@ -252,3 +252,17 @@ security:
252
252
- bearerAuth :
253
253
- read
254
254
- write
255
+ servers :
256
+ - url : ' https://{customerId}.saas-app.com:{port}/v2'
257
+ description : Production server (uses live data)
258
+ variables :
259
+ customerId :
260
+ default : demo
261
+ description : Customer ID assigned by the service provider
262
+ port :
263
+ enum :
264
+ - ' 443'
265
+ - ' 8443'
266
+ default : ' 443'
267
+ - url : ' https://sandbox-api.example.com:8443/v1'
268
+ description : Sandbox server (uses test data)
Original file line number Diff line number Diff line change 1
1
documentation :
2
- components :
2
+ version : " v1.0.0"
3
+ title : " Site API"
4
+ description : ${file(serverless.doc.description.yml):description}
5
+ authorization : Bearer <token>
3
6
securitySchemes :
4
7
bearerAuth :
5
8
type : oauth2
@@ -14,6 +17,20 @@ documentation:
14
17
- bearerAuth :
15
18
- read
16
19
- write
20
+ servers :
21
+ - url : https://{customerId}.saas-app.com:{port}/v2
22
+ description : Production server (uses live data)
23
+ variables :
24
+ customerId :
25
+ default : demo
26
+ description : Customer ID assigned by the service provider
27
+ port :
28
+ enum :
29
+ - " 443"
30
+ - " 8443"
31
+ default : " 443"
32
+ - url : https://sandbox-api.example.com:8443/v1
33
+ description : Sandbox server (uses test data)
17
34
models :
18
35
- name : ErrorResponse
19
36
description : This is an error
You can’t perform that action at this time.
0 commit comments