Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
toString(format = this.opts.format) {
if (String(format).toLowerCase() === 'yaml' || String(format).toLowerCase() === 'yml') {
return $RefParser.YAML.stringify(this.combinedSchema);
}
return JSON.stringify(this.combinedSchema, null, 2);
}
}
module.exports = SwaggerParser;
/**
* This class parses a Swagger 2.0 or 3.0 API, resolves its JSON references and their resolved values,
* and provides methods for traversing, dereferencing, and validating the API.
*
* @constructor
* @extends $RefParser
*/
function SwaggerParser () {
$RefParser.apply(this, arguments);
}
util.inherits(SwaggerParser, $RefParser);
SwaggerParser.YAML = $RefParser.YAML;
SwaggerParser.parse = $RefParser.parse;
SwaggerParser.resolve = $RefParser.resolve;
SwaggerParser.bundle = $RefParser.bundle;
SwaggerParser.dereference = $RefParser.dereference;
/**
* Alias {@link $RefParser#schema} as {@link SwaggerParser#api}
*/
Object.defineProperty(SwaggerParser.prototype, "api", {
configurable: true,
enumerable: true,
get () {
return this.schema;
}
});