@joi-extensions/joi-extensions

1.2.0 • Public • Published

Joi extensions

Extensions for Joi validator.

Build Status npm GitHub license GitHub issues

Installation

 npm install @joi-extensions/joi-extensions

Usage

Usage is a two steps process. First, a schema is constructed using the provided types and constraints:

const BaseJoi = require('joi')
const {AnyExtensions} = require('@joi-extensions/joi-extensions')
const Joi = BaseJoi.extend(AnyExtensions)

const schema = Joi.any().sizeof(20)
const BaseJoi = require('joi')
const {StringExtensions} = require('@joi-extensions/joi-extensions')
const Joi = BaseJoi.extend(StringExtensions)

const schema = Joi.string().objectId()
const BaseJoi = require('joi')
const {ArrayExtensions} = require('@joi-extensions/joi-extensions')
const Joi = BaseJoi.extend(ArrayExtensions)

const schema = Joi.array().even()

API

See the detailed API Reference.

Package Sidebar

Install

npm i @joi-extensions/joi-extensions

Weekly Downloads

29

Version

1.2.0

License

MIT

Unpacked Size

26 kB

Total Files

17

Last publish

Collaborators

  • alberthambardzumyan