mapeo-schema v2.0.2
mapeo-schema
Document schemas, validators and flow types for Mapeo
Original draft: https://hackmd.io/wlMcMM65TmuPXGYOEbOR2g#
Table of Contents
Install
npm install --save mapeo-schemaUsage
JS validation functions
const mapeoSchema = require('mapeo-schema')
// also
const validateObservation = require('mapeo-schema/validateObservation')
const testObservation = {...}
const isValid = mapeoSchema.validateObservation(testObservation);
// returns true if validates against schema, false otherwise.
// errors a static prop on mapeoSchema.validateObservation.errorsFlow types
import type { Observation } from 'mapeo-schema'
const myObs: Observation = {...}API
Maintainers
Contributing
It looks like there is no code in this repo. All the code is generated from the JSON Schema definitions. To build the validator functions and flow definitions:
npm run buildTests are also generated dynamically. Place an example minimal and valid JSON
for a particular schema in the examples folder, with a filename
that matches the schema filename, e.g. if you add a schema called
mySchema.json then add an example mySchema.minimal.json and
mySchema.full.json. "Minimal" means with only the required properties, where
"full" means with all the defined properties in the schema document. To run
tests:
npm testBefore publishing, update the docs with:
npm run docsLicense
MIT © 2019 Digital Democracy
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago