joi2json
v1.0.4
Published
Joi ⇄ JSON-Schema Converter
Downloads
16
Readme
Joi ⇄ JSON-Schema Converter
JSON Schema and Joi converter Forked from joi-to-json-schema and enjoi
Install
$ npm install joi2json --save
Usage
const parser = require('joi2json')
const schema = {
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
}
},
"required": ["firstName", "lastName"]
}
// JSON Schema to Joi
const joiObj = parser.enjoi(schema)
// Joi to JSON Schema
const jsonSchema = parser.dejoi(joiObj)