JSON schema validator for apeman.
npm install apemanschemaapemanschema
==========
[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![Code Climate][bd_codeclimate_shield_url]][bd_codeclimate_url]
[![Code Coverage][bd_codeclimate_coverage_shield_url]][bd_codeclimate_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]
[bd_repo_url]: https://github.com/apeman-labo/apemanschema
[bd_travis_url]: http://travis-ci.org/apeman-labo/apemanschema
[bd_travis_shield_url]: http://img.shields.io/travis/apeman-labo/apemanschema.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/apeman-labo/apemanschema
[bd_travis_com_shield_url]: https://api.travis-ci.com/apeman-labo/apemanschema.svg?token=
[bd_license_url]: https://github.com/apeman-labo/apemanschema/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/apeman-labo/apemanschema
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/apeman-labo/apemanschema.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/apeman-labo/apemanschema.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/apeman-labo/apemanschema
[bd_gemnasium_shield_url]: https://gemnasium.com/apeman-labo/apemanschema.svg
[bd_npm_url]: http://www.npmjs.org/package/apemanschema
[bd_npm_shield_url]: http://img.shields.io/npm/v/apemanschema.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
JSON schema validator for apeman.
Installation
-----
``bash`
$ npm install apemanschema --save
Usage
---------
Create a directory with name "schemas" and put schema files like "User.schema.json" there.
schemas/user.json
`javascript`
{
"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"
]
}
schemas/index.js
`javascript
'use strict'
const apemanschema = require('apemanschema')
// Exports schemas as module.
module.exports = apemanschema(__dirname, {
// Options
})
`
Then,
`javascript
'use strict'
// Require defined schemas
const schemas = require('./schemas/index.js')
let error = schemas('user').validate({
name: 'foo'
})
console.log(error)
``
License
-------
This software is released under the MIT License.
Links
------
+ [apeman][apeman_url]
+ [JSON schema][j_s_o_n_schema_url]
+ [tv4][tv4_url]
[apeman_url]: https://www.npmjs.com/package/apeman
[j_s_o_n_schema_url]: http://json-schema.org/
[tv4_url]: https://github.com/geraintluff/tv4