How to use the amf-client-js.ProfileNames 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
_validate(doc, type) {
    this.logger.info('API parsed.');
    this.logger.info('Validating API...');
    let validateProfile;
    switch (type) {
      case 'RAML 1.0': validateProfile = amf.ProfileNames.RAML; break;
      case 'RAML 0.8': validateProfile = amf.ProfileNames.RAML08; break;
      case 'OAS 2.0':
      case 'OAS 3.0':
        validateProfile = amf.ProfileNames.OAS;
        break;
    }
    return amf.AMF.validate(doc, validateProfile)
    .then((report) => {
      if (!report.conforms) {
        this.logger.warn(report.toString());
      } else {
        this.logger.info('API valid.');
      }
      return doc;
    });
  }

amf-client-js

AMF Library

Apache-2.0
Latest version published 10 days ago

Package Health Score

81 / 100
Full package analysis

Similar packages