joi2json

1.0.4 • Public • Published

Joi ⇄ JSON-Schema Converter

JavaScript Style Guide Build Status npm download

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)

Readme

Keywords

Package Sidebar

Install

npm i joi2json

Weekly Downloads

16

Version

1.0.4

License

ISC

Unpacked Size

41.2 kB

Total Files

7

Last publish

Collaborators

  • cynosure