aschema
JSON schema validator
Last updated a year ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install aschema 
SYNC missed versions from official npm registry.

aschema

Build Status Code Climate Code Coverage npm Version JS Standard

JSON schema validator

Installation

$ npm install aschema --save

Usage

'use strict'

const aschema = require('aschema')

// Define a schema object
const userSchema = aschema({
  title: 'User',
  description: 'A user',
  type: 'object',
  properties: {
    id: {
      description: 'The unique identifier for a account',
      type: 'integer'
    },
    accountName: {
      description: 'Name of the account',
      type: 'string'
    }
  },
  required: [
    'id',
    'name'
  ]
})

// Execute validation
let error = userSchema.validate({
  name: 'foo'
})

if (error) {
  console.error(error)
} else {
  console.log('no error!')
}

License

This software is released under the MIT License.

Links

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (12)

Copyright 2014 - 2017 © taobao.org |