1.0.4 • Published 5 years ago

joi2json v1.0.4

Weekly downloads
21
License
ISC
Repository
github
Last release
5 years ago

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)
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago