3.1.0 • Published 6 years ago

aschema v3.1.0

Weekly downloads
210
License
MIT
Repository
github
Last release
6 years ago

aschema

Build Status 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

3.1.0

6 years ago

3.0.3

7 years ago

3.0.2

7 years ago

3.0.0

7 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.9

9 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago