How to use the amf-client-js.render 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 advanced-rest-client / arc-electron / scripts / packages / amf-service / lib / amf-resolver.js View on Github external
function generateEditingResolvedModel(doc, type) {
  const resolver = amf.Core.resolver(type);
  doc = resolver.resolve(doc, 'editing');
  const generator = amf.Core.generator('AMF Graph', 'application/ld+json');
  const opts = amf.render.RenderOptions().withSourceMaps.withCompactUris;
  return generator.generateString(doc, opts);
}
github mulesoft-labs / api-console-cli / lib / generate-json.js View on Github external
_save(doc, file) {
    this.logger.info('Generating json-ld model...');
    const opts = amf.render.RenderOptions().withSourceMaps.withCompactUris;
    const generator = amf.Core.generator('AMF Graph', 'application/ld+json');
    const start = Date.now();
    return generator.generateString(doc, opts)
    .then((data) => {
      const time = Date.now() - start;
      this.logger.info(`Model ready in ${time} milliseconds`);
      this.logger.info('Storing API data model to file: ' + file);
      const dir = path.dirname(file);
      return fs.ensureDir(dir)
      .then(() => fs.writeFile(file, data, 'utf8'));
    });
  }

amf-client-js

AMF Library

Apache-2.0
Latest version published 16 days ago

Package Health Score

87 / 100
Full package analysis

Similar packages