lib/objection-swagger.js
function saveQueryParamSchema(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 modelSchema = jsonSchemaTransformer.transformSchema(schema, opts);
    const queryParamSchema = queryParamTransformer.transformIntoQueryParamSchema(
      modelSchema
    );

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

  return yamlWriter.writeYamlsToFs(yamlSchemaContainers, targetDir, opts);
}
function saveQueryParamSchema(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 modelSchema = jsonSchemaTransformer.transformSchema(schema, opts);
    const queryParamSchema = queryParamTransformer.transformIntoQueryParamSchema(
      modelSchema
    );

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

  return yamlWriter.writeYamlsToFs(yamlSchemaContainers, targetDir, opts);
}
function saveQueryParamSchema ( 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 modelSchema = jsonSchemaTransformer . transformSchema ( schema , opts ) ; const queryParamSchema = queryParamTransformer . transformIntoQueryParamSchema ( modelSchema ) ; return { name : schema . title , schema : yaml . dump ( queryParamSchema ) } ; } ) ; return yamlWriter . writeYamlsToFs ( yamlSchemaContainers , targetDir , opts ) ; }
Generates and saves into specified directory JSON-schema YAML files for inclusion in Swagger query param
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 query param specifications from given JSON - schemas