How to use the json-refs.resolveRefsAt function in json-refs

To help you get started, we’ve selected a few json-refs 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 apigee-127 / sway / index.js View on Github external
cOptions.jsonRefs.filter = ['relative', 'remote'];

      // Update the json-refs options to process YAML
      if (_.isUndefined(cOptions.jsonRefs.loaderOptions)) {
        cOptions.jsonRefs.loaderOptions = {};
      }

      if (_.isUndefined(cOptions.jsonRefs.loaderOptions.processContent)) {
        cOptions.jsonRefs.loaderOptions.processContent = function (res, cb) {
          cb(undefined, YAML.safeLoad(res.text));
        };
      }

      // Call the appropriate json-refs API
      if (_.isString(cOptions.definition)) {
        return JsonRefs.resolveRefsAt(cOptions.definition, cOptions.jsonRefs);
      } else {
        return JsonRefs.resolveRefs(cOptions.definition, cOptions.jsonRefs);
      }
    })
    // Resolve local references and merge results

json-refs

Various utilities for JSON References (http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03).

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis