7.2.0 • Published 7 years ago

apemanschema v7.2.0

Weekly downloads
10
License
MIT
Repository
github
Last release
7 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

7 years ago

7.0.1

8 years ago

7.0.0

8 years ago

6.0.6

8 years ago

6.0.5

8 years ago

6.0.4

8 years ago

6.0.3

8 years ago

6.0.2

8 years ago

6.0.1

8 years ago

6.0.0

8 years ago

5.0.2

8 years ago

5.0.1

8 years ago

5.0.0

8 years ago

4.0.0

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.1.0

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago