This repository was archived by the owner on Dec 10, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +41
-4
lines changed Expand file tree Collapse file tree 4 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ export class DefinitionGenerator {
4242 version = uuid . v4 ( ) ,
4343 models,
4444 security,
45- securitySchemes
45+ securitySchemes,
46+ servers
4647 } = this . config ;
4748
4849 _ . merge ( this . definition , {
@@ -62,6 +63,10 @@ export class DefinitionGenerator {
6263 this . definition . components . securitySchemes = securitySchemes ;
6364 }
6465
66+ if ( servers ) {
67+ this . definition . servers = servers ;
68+ }
69+
6570 this . definition . components . schemas = await parseModels ( models , this . root ) ;
6671
6772 return this ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export interface DefinitionConfig {
1616 version ?: string ;
1717 securitySchemes : OpenAPIV3 . SecuritySchemeObject ;
1818 security : Array < OpenAPIV3 . SecurityRequirementObject > ;
19+ servers : Array < OpenAPIV3 . ServerObject > ;
1920 models : Array < Model > ;
2021}
2122
Original file line number Diff line number Diff line change @@ -196,9 +196,9 @@ components:
196196 write : Grants write access
197197 admin : Grants access to admin operations
198198info :
199- title : ' '
199+ title : Site API
200200 description : ' '
201- version : 6e48be1a-d9be-41ef-95eb-41ffad58eac3
201+ version : v1.0.0
202202paths :
203203 ' /create/{username} ' :
204204 post :
@@ -252,3 +252,17 @@ security:
252252 - bearerAuth :
253253 - read
254254 - 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 11documentation :
2- components :
2+ version : " v1.0.0"
3+ title : " Site API"
4+ description : ${file(serverless.doc.description.yml):description}
5+ authorization : Bearer <token>
36 securitySchemes :
47 bearerAuth :
58 type : oauth2
@@ -14,6 +17,20 @@ documentation:
1417 - bearerAuth :
1518 - read
1619 - 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)
1734 models :
1835 - name : ErrorResponse
1936 description : This is an error
You can’t perform that action at this time.
0 commit comments