apemanschema
JSON schema validator for apeman.
Last updated 3 years ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install apemanschema 
SYNC missed versions from official npm registry.

apemanschema

Build Status Code Climate Code Coverage npm Version JS Standard

JSON schema validator for apeman.

Installation

$ npm install apemanschema --save

Usage

Create a directory with name "schemas" and put schema files like "User.schema.json" there.

schemas/user.json

{
  "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

'use strict'

const apemanschema = require('apemanschema')

// Exports schemas as module.
module.exports = apemanschema(__dirname, {
  // Options
})

Then,

'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

Current Tags

  • 7.2.0                                ...           latest (3 years ago)

32 Versions

  • 7.2.0                                ...           3 years ago
  • 7.0.1                                ...           4 years ago
  • 7.0.0                                ...           4 years ago
  • 6.0.6                                ...           4 years ago
  • 6.0.5                                ...           4 years ago
  • 6.0.4                                ...           4 years ago
  • 6.0.3                                ...           4 years ago
  • 6.0.2                                ...           4 years ago
  • 6.0.1                                ...           4 years ago
  • 6.0.0                                ...           4 years ago
  • 5.0.2                                ...           4 years ago
  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.4                                ...           4 years ago
  • 3.0.3                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.3.1                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (11)

Copyright 2014 - 2017 © taobao.org |