lib/objection-swagger.js
function saveNonModelSchema(schemaParam, targetDir, opts = {}) {
  validate.notNil(schemaParam, "schemaParam is mandatory");
  validate.notNil(targetDir, "targetDir is mandatory");

  if (!Array.isArray(schemaParam)) {
    schemaParam = [schemaParam];
  }
  const yamlSchemaContainers = schemaParam.map(schema => {
    const processedSchema = jsonSchemaTransformer.transformSchema(schema, opts);

    return {
      name: schema.title,
      schema: yaml.dump(processedSchema)
    };
  });

  return yamlWriter.writeYamlsToFs(yamlSchemaContainers, targetDir, opts);
}
function saveNonModelSchema(schemaParam, targetDir, opts = {}) {
  validate.notNil(schemaParam, "schemaParam is mandatory");
  validate.notNil(targetDir, "targetDir is mandatory");

  if (!Array.isArray(schemaParam)) {
    schemaParam = [schemaParam];
  }
  const yamlSchemaContainers = schemaParam.map(schema => {
    const processedSchema = jsonSchemaTransformer.transformSchema(schema, opts);

    return {
      name: schema.title,
      schema: yaml.dump(processedSchema)
    };
  });

  return yamlWriter.writeYamlsToFs(yamlSchemaContainers, targetDir, opts);
}
function saveNonModelSchema ( schemaParam , targetDir , opts = { } ) { validate . notNil ( schemaParam , "schemaParam is mandatory" ) ; validate . notNil ( targetDir , "targetDir is mandatory" ) ; if ( ! Array . isArray ( schemaParam ) ) { schemaParam = [ schemaParam ] ; } const yamlSchemaContainers = schemaParam . map ( schema => { const processedSchema = jsonSchemaTransformer . transformSchema ( schema , opts ) ; return { name : schema . title , schema : yaml . dump ( processedSchema ) } ; } ) ; return yamlWriter . writeYamlsToFs ( yamlSchemaContainers , targetDir , opts ) ; }
Generates and saves into specified directory JSON-schema YAML files for inclusion in Swagger specifications from
given JSON-schemas
@param {Object|Object[]} schemaParam - JSON-Schema(s) to generate yamls for. Title param is used as a filename
@param {string} targetDir - directory to write generated schemas to. Do not add '/' to the end.
@param {Options} opts
@returns {Promise} - promise that is resolved after yamls are written
Generates and saves into specified directory JSON - schema YAML files for inclusion in Swagger specifications from given JSON - schemas