How to use the json-schema-ref-parser.parse function in json-schema-ref-parser

To help you get started, we’ve selected a few json-schema-ref-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github psastras / swagger2aglio / index.js View on Github external
function convert(program, callback) {

  // define no-op callback
  if (!callback) {
    callback = function (err, blueprint) { }
  }

  // Read in the file
  refparser.parse(program.input, function (err, schema) {
    if (err) isMain ? halt(err) : callback(err);
    // Read in aglio options
    var options = {
      themeTemplate: (program.themeTemplate === 'triple' || program.themeTemplate === 'index' || !program.themeTemplate) ?
        path.resolve(__dirname, 'templates/' + (program.themeTemplate || 'index') + '.jade') :
        themeTemplate,
      themeVariables: program.themeVariables,
      themeFullWidth: program.themeFullWidth,
      noThemeCondense: program.noThemeCondense,
      themeStyle: program.themeStyle,
      locals: {
        livePreview: program.server,
        host: ((schema.schemes && schema.schemes.length > 0 && schema.host) ? 
          (schema.schemes[0] || 'https') 
          : 'https') 
          + '://' + schema.host + (schema.basePath || '')
github twskj / pretty-swag / pretty-swag.js View on Github external
function parse(src, dst, config, callback) {

    if (typeof src === "object") {
        addAnnotation(src);
        parseV2(src, dst, config, callback);
    }
    else {
        $RefParser.parse(src, function (err, data) {
            if (err) {
                return callback(err);
            }
            try {
                addAnnotation(data);
                parseV2(data, dst, config, callback);
            }
            catch (err) {
                return callback(err);
            }
        });
    }
}