How to use the json-schema-ref-parser 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 adiwg / mdEditor / app / services / schemas.js View on Github external
import Service from '@ember/service';
import RefParser from 'json-schema-ref-parser';
import request from 'ember-ajax/request';
import { task, all, timeout } from 'ember-concurrency';
import { inject as service } from '@ember/service';
import {
  // isAjaxError,
  isNotFoundError,
  // isForbiddenError
} from 'ember-ajax/errors';
import semver from 'semver';

const parser = new RefParser();

export default Service.extend({
  init() {
    this._super(...arguments);

    /**
     * Instance of JSON Schema $Ref Parser
     *
     * @method parser
     * @protected
     * @return {Object}
     */
    this.parser = parser;
  },
  flashMessages: service(),
  fetchSchemas: task(function* (url) {
github cyclosproject / ng-openapi-gen / src / index.ts View on Github external
async function ngOpenApiGen() {
  const options = parseOptions();
  const refParser = new $RefParser();
  const input = options.input;
  try {
    const openApi = await refParser.bundle(input, { dereference: { circular: false } }) as OpenAPIObject;
    const gen = new NgOpenApiGen(openApi, options);
    gen.generate();
  } catch (err) {
    console.error(`Error on API generation from ${input}: ${err}`);
  }
}
github cyclosproject / ng-openapi-gen / lib / ng-openapi-gen.ts View on Github external
export async function runNgOpenApiGen() {
  const options = parseOptions();
  const refParser = new $RefParser();
  const input = options.input;
  try {
    const openApi = await refParser.bundle(input, { dereference: { circular: false } }) as OpenAPIObject;
    const gen = new NgOpenApiGen(openApi, options);
    gen.generate();
  } catch (err) {
    console.error(`Error on API generation from ${input}: ${err}`);
  }
}
github exegesis-js / exegesis / src / index.ts View on Github external
function bundle(
    openApiDocFile: string | object,
): Promise {
    const refParser = new $RefParser();

    return refParser.bundle(
        openApiDocFile as any,
        {dereference: {circular: false}}
    );
}
github Springworks / swagger-md / src / prepare-spec.js View on Github external
export default function prepareSpec(spec, options) {
  const parser = new RefParser();
  const external = !!(options && options.external === true);
  return parser.dereference(spec, { external });
}