All Projects → vandium-io → Joi Json

vandium-io / Joi Json

Licence: bsd-3-clause
Builds Joi schemas from JSON

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Joi Json

Furion
Make .NET development easier, more versatile, and more popular.
Stars: ✭ 902 (+5913.33%)
Mutual labels:  validation
Ismailfine
A simple (but correct) library for validating email addresses. Supports mail addresses as defined in rfc5322 as well as the new Internationalized Mail Address standards (rfc653x). Based on https://github.com/jstedfast/EmailValidation
Stars: ✭ 9 (-40%)
Mutual labels:  validation
Kubevious
Kubevious - application centric Kubernetes UI and continuous assurance provider
Stars: ✭ 869 (+5693.33%)
Mutual labels:  validation
Cafy
☕️ Simple, lightweight, flexible validator generator
Stars: ✭ 22 (+46.67%)
Mutual labels:  validation
Trumail
✉️ ✅ A Fast and Free Email Verification API written in Go
Stars: ✭ 937 (+6146.67%)
Mutual labels:  validation
Structured Acceptance Test
An open format definition for static analysis tools
Stars: ✭ 10 (-33.33%)
Mutual labels:  validation
Swiftyform
iOS framework for creating forms
Stars: ✭ 907 (+5946.67%)
Mutual labels:  validation
Cymbology
Identifies and validates financial security ids such as Sedol, Cusip, Isin numbers.
Stars: ✭ 13 (-13.33%)
Mutual labels:  validation
Validformbuilder
ValidForm Builder. Easy and safe XHTML 1.0 strict forms with validation!
Stars: ✭ 26 (+73.33%)
Mutual labels:  validation
In App Purchase
A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
Stars: ✭ 868 (+5686.67%)
Mutual labels:  validation
Cti Stix Validator
OASIS TC Open Repository: Validator for STIX 2.0 JSON normative requirements and best practices
Stars: ✭ 24 (+60%)
Mutual labels:  validation
Valley
Extensible schema validations and declarative syntax helpers in Python.
Stars: ✭ 25 (+66.67%)
Mutual labels:  validation
Ember I18n Changeset Validations
ember-i18n support for ember-changeset-validations messages
Stars: ✭ 11 (-26.67%)
Mutual labels:  validation
Govalid
Struct validation using tags
Stars: ✭ 22 (+46.67%)
Mutual labels:  validation
Mintype
🍵 minimal composable type abstraction
Stars: ✭ 12 (-20%)
Mutual labels:  validation
Validating
Automatically validating Eloquent models for Laravel
Stars: ✭ 906 (+5940%)
Mutual labels:  validation
Egg Valid
👮Validation plugin for eggjs
Stars: ✭ 10 (-33.33%)
Mutual labels:  validation
Typet
Types that make coding in Python quick and safe.
Stars: ✭ 15 (+0%)
Mutual labels:  validation
Sequelize Joi
Joi schema validation for Sequelize models
Stars: ✭ 13 (-13.33%)
Mutual labels:  validation
Openapi3 Validator
Validator for OpenAPI v3 specs
Stars: ✭ 11 (-26.67%)
Mutual labels:  validation

Build Status npm version

Joi-JSON

Creates Joi based object schemas from JSON.

Features

  • Create Joi schemas from JSON data
  • Express simple schemas using a single string
  • Lightweight with minimal dependencies
  • Compatible with most of the Joi API
  • Node.js 10.x compatible for use in AWS Lambda environments
  • Supports @hapi/joi implementation

Installation

Install via npm.

npm install joi-json --save

Note: @hapi/joi needs to be installed into your project

Getting Started

const builder = require( 'joi-json' ).builder();

let jsonSchema = {

    firstName: 'string:min=1,max=60,required',  // string using string-based notation

    lastName: { // string using object notation

        '@type': 'string',
        min: 1,
        max: 60,
        required: true
    },

    address: {  // address is an object (i.e. joi.object() )

        street: 'string:min=1,max=80,required',
        street2: 'string:min=1,max=80',
        city: 'string:min=1,max=40,required',
        state: 'string:min=1,max=40,required',
        postal: 'string:min=1,max=20,required',

        '@required': true   // needs the '@' to indicate that "required" is a property
    },

    // alternative values (i.e. joi.alternatives().try() )
    favNumberOrWord: [

        'string:min=1,max=10',
        'number:min=0,max=100'
    ]
};

let schema = builder.build( jsonSchema );

Which would yield the equivalent to the following joi schema:

const joi = require( '@hapi/joi' );

let schema = {

    firstName: joi.string().min(1).max(60).trim().required(),

    lastName: joi.string().min(1).max(60).trim().required(),

    address: Object.keys( {

            street: joi.string().min(1).max(80).trim().required(),
            street2: joi.string().min(1).max(80).trim(),
            city: joi.string().min(1).max(40).trim().required(),
            state: joi.string().min(1).max(40).trim().required(),
            postal: joi.string().min(1).max(20).trim().required()

        }).required(),

    favNumberOrWord: [

            joi.string().min(1).max(10).trim(),
            joi.number().min(1).max(100)
        ]
};

Documentation

For information on how to use Joi-JSON, please see our API documentation

Feedback

We'd love to get feedback on how to make this tool better. Feel free to contact us at [email protected]

License

BSD-3-Clause

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].