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

  let models;
  if (_.isArray(modelParam)) {
    models = modelParam;
  } else if (_.isObject(modelParam)) {
    models = [modelParam];
  } else {
    throw new Error("modelParam should be an object or an array of objects");
  }

  return models.map(model => {
    const processedSchema = modelTransformer.transformJsonSchemaFromModel(
      model,
      opts
    );

    return {
      name: model.name,
      schema: processedSchema
    };
  });
}
function generateSchemaRaw(modelParam, opts = {}) {
  validate.notNil(modelParam, "modelParam is mandatory");

  let models;
  if (_.isArray(modelParam)) {
    models = modelParam;
  } else if (_.isObject(modelParam)) {
    models = [modelParam];
  } else {
    throw new Error("modelParam should be an object or an array of objects");
  }

  return models.map(model => {
    const processedSchema = modelTransformer.transformJsonSchemaFromModel(
      model,
      opts
    );

    return {
      name: model.name,
      schema: processedSchema
    };
  });
}
function generateSchemaRaw ( modelParam , opts = { } ) { validate . notNil ( modelParam , "modelParam is mandatory" ) ; let models ; if ( _ . isArray ( modelParam ) ) { models = modelParam ; } else if ( _ . isObject ( modelParam ) ) { models = [ modelParam ] ; } else { throw new Error ( "modelParam should be an object or an array of objects" ) ; } return models . map ( model => { const processedSchema = modelTransformer . transformJsonSchemaFromModel ( model , opts ) ; return { name : model . name , schema : processedSchema } ; } ) ; }
Generates JSON schemas from Objection.js models
@param {Model|Model[]} modelParam - model(s) to generate schemas for
@param {Options} opts
@returns {GeneratedSwagger[]} generated JSON schemas as objects
Generates JSON schemas from Objection . js models