A module that loads swagger and OpenAPI 3.0 format API specifications and provides the service endpoint descriptors
Members
(inner) oasModel
The Original OpenAPI model as it was loaded
Methods
(async, static) loadOas(oasFile, oasOptions, endpointOptions) → {Promise}
Load swagger and/or OpenAPI specification The specification can be a single file, or that can made of several partials. It also can be a swagger object.
Parameters:
Name | Type | Description |
---|---|---|
oasFile |
String | Object | The path string of the root file of the API specification, or a swagger object. |
oasOptions |
Object | The options of the loader. See swagger-parser options for details. |
endpointOptions |
Object | The options of the endpoint descriptors. See defaultEndpointOptions for details. |
Returns:
A Promise, that resolves to an API descriptor object, that provides inner functions to access to the individual endpoints as well as to the whole loaded model.
- Type
- Promise
(inner) getEndpoints() → {Array}
Get all the endpoins defined by the API
Parameters:
Type | Description |
---|---|
Object | The options that control the details of endpoints of the API. Optional. Defaults: |
Returns:
- The array of endpoints of the API
- Type
- Array
(inner) getNonStaticEndpoints() → {Array}
Get the normal REST endpoins defined by the API
Parameters:
Type | Description |
---|---|
Object | The options that control the details of endpoints of the API. Optional. Defaults: |
Returns:
- The array of normal, (non-static, REST) endpoints of the API
- Type
- Array
(inner) getOasModel()
Return with the original OAS model
(inner) getServers() → {Array}
Get the list of servers
Returns:
- The array of server descriptor objects.
Each server descriptor holds the details about the servers like it is defined for the swagger 2.0 format files:
{ host, basePath, schemes: [] }
. OpenApi v3 format files are converted to this format as well.
- Type
- Array
(inner) getStaticEndpoints() → {Array}
Get the static endpoins defined by the API
Parameters:
Type | Description |
---|---|
Object | The options that control the details of endpoints of the API. Optional. Defaults: |
Returns:
- The array of static endpoints of the API
- Type
- Array
(inner) getTitle() → {String}
Get the title of the API
Returns:
- The title of the API
- Type
- String
(inner) getVersion() → {String}
Get the version of the API
Returns:
- The version of the API
- Type
- String