options.js 1010 B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. const $RefParserOptions = require("@apidevtools/json-schema-ref-parser/lib/options");
  3. const schemaValidator = require("./validators/schema");
  4. const specValidator = require("./validators/spec");
  5. const util = require("util");
  6. module.exports = ParserOptions;
  7. /**
  8. * Options that determine how Swagger APIs are parsed, resolved, dereferenced, and validated.
  9. *
  10. * @param {object|ParserOptions} [_options] - Overridden options
  11. * @class
  12. * @augments $RefParserOptions
  13. */
  14. function ParserOptions (_options) {
  15. $RefParserOptions.call(this, ParserOptions.defaults);
  16. $RefParserOptions.apply(this, arguments);
  17. }
  18. ParserOptions.defaults = {
  19. /**
  20. * Determines how the API definition will be validated.
  21. *
  22. * You can add additional validators of your own, replace an existing one with
  23. * your own implemenation, or disable any validator by setting it to false.
  24. */
  25. validate: {
  26. schema: schemaValidator,
  27. spec: specValidator,
  28. },
  29. };
  30. util.inherits(ParserOptions, $RefParserOptions);