0.1.0 • Published 4 years ago
jsonotron-fields v0.1.0
A library of field type definitions included with the Jsonotron engine
A library of field type definitions. This is in a separate library so that it can be included in the Jsonotron engine but also incorporated into documentation pipelines.
This package is part of the Jsonotron system.
Jsonotron is...
- a small set of components for building a NodeJS microservice
- for storing, patching and querying JSON documents
- stored in a schemaless/NoSQL database
- that have known, enforceable, and evolving schemas.
Visit https://karlhulme.github.io/jsonotron/ for details on how to get started.
Installation
npm install jsonotron-fields --save
Usage
const { builtinFieldTypes, combineCustomAndBuiltinFieldTypes, createAjvForFieldTypes, ensureFieldTypesAreValid } = require('jsonotron-fields')
const customFieldTypes = [] // add custom field types here
const combinedFieldTypes = combineCustomAndBuiltinFieldTypes(customFieldTypes, builtinFieldTypes)
const ajv = createAjvForFieldTypes(combinedFieldTypes)
ensureFieldTypesAreValid(ajv, combinedFieldTypes)
Development
Code base adheres to the rules chosen by https://standardjs.com/. Code is formatted with 2 spaces.
Tests are written using Jest with 100% coverage.
npm test
Continuous Deployment
Any commits to master will cause the library to be re-published.