How to use the amf-client-js.plugins function in amf-client-js

To help you get started, we’ve selected a few amf-client-js 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 mulesoft-labs / api-console-cli / lib / generate-json.js View on Github external
run() {
    let msg = 'Generating API model from ' + this.apiFile;
    msg += ' using ' + this.apiType + ' parser';
    this.logger.info(msg);

    amf.plugins.document.WebApi.register();
    amf.plugins.document.Vocabularies.register();
    amf.plugins.features.AMFValidation.register();
    return amf.Core.init()
    .then(() => this.gaUsage())
    .then(() => this._parse(this.apiFile, this.apiType))
    .then((doc) => this._validate(doc, this.apiType))
    .then((doc) => this._resolve(doc, this.apiType))
    .then((doc) => this._save(doc, this.output));
  }
  /**
github mulesoft-labs / api-console-cli / lib / generate-json.js View on Github external
run() {
    let msg = 'Generating API model from ' + this.apiFile;
    msg += ' using ' + this.apiType + ' parser';
    this.logger.info(msg);

    amf.plugins.document.WebApi.register();
    amf.plugins.document.Vocabularies.register();
    amf.plugins.features.AMFValidation.register();
    return amf.Core.init()
    .then(() => this.gaUsage())
    .then(() => this._parse(this.apiFile, this.apiType))
    .then((doc) => this._validate(doc, this.apiType))
    .then((doc) => this._resolve(doc, this.apiType))
    .then((doc) => this._save(doc, this.output));
  }
  /**
github advanced-rest-client / arc-electron / scripts / packages / amf-service / lib / amf-resolver.js View on Github external
const amf = require('amf-client-js');
amf.plugins.document.WebApi.register();
amf.plugins.document.Vocabularies.register();
amf.plugins.features.AMFValidation.register();
/**
 * Parses AMF ld+json model to AMF document.
 * The model has to be unresolved.
 *
 * @param {String} model
 * @return {Promise} AMF document.
 */
function modelToDoc(model) {
  const parser = amf.Core.parser('AMF Graph', 'application/ld+json');
  return parser.parseStringAsync(model);
}
/**
 * Generates resolved AMF model using editing pipeline (required by API console).
 * @param {Object} doc Parsed API document to AMF object.
github advanced-rest-client / arc-electron / scripts / packages / amf-service / lib / amf-resolver.js View on Github external
const amf = require('amf-client-js');
amf.plugins.document.WebApi.register();
amf.plugins.document.Vocabularies.register();
amf.plugins.features.AMFValidation.register();
/**
 * Parses AMF ld+json model to AMF document.
 * The model has to be unresolved.
 *
 * @param {String} model
 * @return {Promise} AMF document.
 */
function modelToDoc(model) {
  const parser = amf.Core.parser('AMF Graph', 'application/ld+json');
  return parser.parseStringAsync(model);
}
/**
 * Generates resolved AMF model using editing pipeline (required by API console).
 * @param {Object} doc Parsed API document to AMF object.
 * @param {String} type API original type (RAML 1.0, OAS 2.0, etc)
 * @return {Promise} A promise resolved to AMF object.

amf-client-js

AMF Library

Apache-2.0
Latest version published 19 days ago

Package Health Score

84 / 100
Full package analysis

Similar packages