Module: swagger-spec-validator

Source:

Members

(inner, constant) DEFAULT_HEADERS

Default headers sent with API requests.
Source:

(inner, constant) DEFAULT_URL

Default URL to which validation requests are sent.
Source:

Methods

(static) validate(spec, optionsopt, callbackopt, nullable) → {Promise.<object>|undefined}

Validates an OpenAPI/Swagger API specification.
Parameters:
Name Type Attributes Description
spec string | Uint8Array | module:stream.Readable OpenAPI/Swagger API specification content.
options ValidateOptions <optional>
Validation options.
callback function <optional>
<nullable>
Callback for the validation results object.
Source:
Returns:
If callback is not given, a Promise with the validation results or Error.
Type
Promise.<object> | undefined

(static) validateFile(specPath, optionsopt, callbackopt, nullable) → {Promise.<object>|undefined}

Validates an OpenAPI/Swagger API specification file. If not specified, the Content-Type header will be set for .json and .yaml/.yml files.
Parameters:
Name Type Attributes Description
specPath string Path of OpenAPI/Swagger API specification file.
options ValidateOptions <optional>
Validation options.
callback function <optional>
<nullable>
Callback for the validation results object.
Source:
Returns:
If callback is not given, a Promise with the validation results or Error.
Type
Promise.<object> | undefined

Type Definitions

ValidateOptions

Validation options
Type:
  • Object
Properties:
Name Type Attributes Description
err module:stream.Writable <optional>
Stream to which errors (and non-output status messages) are written. (default: process.stderr)
request object <optional>
Options passed to http.request().
url URL | object | string URL passed to http.request().
verbosity number <optional>
Amount of output to produce. Larger numbers produce more output.
Source: