waterline-joi
v1.1.5
Published
Waterline Blueprint to Joi validation converter
Downloads
22
Readme
Waterline Joi
npm i --save waterline-joi
Waterline Blueprint to Joi validation converter.
// Get Waterline.
var Waterline = require('waterline')
// Get the function to convert schemas.
var waterline_to_joi = require("waterline-joi")
// Define your schema.
var schema = {
attributes: {
firstName: {
type: 'string',
required: true
},
lastName: {
type: 'string',
required: true
}
}
}
// Create a Joi schema.
var joi_schema = waterline_to_joi(schema.attributes)
// Create the user
var User = Waterline.Collection.extend(schema)