Joi Machine
Generate a Joi schema from some JSON or a JS object.
Useful for creating a base to build your schema from when you have a big payload to validate.
Example
npm install -g joi-machineecho '{"foo": {}, "bar": 45, "baz": ["foob"]}' | joi-machine
or
var fs = var concat = var joiMachine = // data.json: {"foo": {}, "bar": 45, "baz": ["foob"]}fs // Output: Joi.object().keys({foo: Joi.object(), bar: Joi.number().integer(), baz: Joi.array().items(Joi.string())})
or
var fs = var concat = var joiMachine = var generator = joiMachine generator // data.json: {"foo": {}, "bar": 45, "baz": ["foob"]}generatorgenerator // Output: Joi.object().keys({foo: Joi.object(), bar: Joi.number().integer(), baz: Joi.array().items(Joi.string())})