Skip to content

standardschema/javascript

Repository files navigation

Standard Schema

NPM version NPM downloads Build status Test coverage

Standard schema is a vocabulary for validating data.

Installation

npm install standardschema --save

Usage

import { schemaFromJSON } from 'standardschema'

const schema = schemaFromJSON({
  '@type': 'Object',
  'properties': [
    {
      '@type': 'Property',
      'key': 'foo',
      'value': { '@type': 'String' }
    }
  ]
})

schema.isAssignable(schemaFromJSON({ '@type': 'Integer' })) //=> false

License

Apache 2.0