7.2.0 • Published 9 years ago

apemanschema v7.2.0

Weekly downloads
10
License
MIT
Repository
github
Last release
9 years ago

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

7.2.0

9 years ago

7.0.1

9 years ago

7.0.0

9 years ago

6.0.6

9 years ago

6.0.5

9 years ago

6.0.4

9 years ago

6.0.3

9 years ago

6.0.2

9 years ago

6.0.1

9 years ago

6.0.0

9 years ago

5.0.2

9 years ago

5.0.1

9 years ago

5.0.0

9 years ago

4.0.0

9 years ago

3.0.4

9 years ago

3.0.3

9 years ago

3.0.2

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.1.0

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago