0.1.7 • Published 4 years ago

jsonotron-schemas v0.1.7

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

A library of schemas used by the Jsonotron system.

npm.io npm JavaScript Style Guide

A library of schemas used by the Jsonotron system to validate document types, field types and role types.

The schemas allow the use of functions to be added to the JS objects via the customTypeOf keyword. For example, on a document type, the implementation of a constructor can be included in the definition because of the following definition:

ctor: {
  type: 'object',
  description: 'A mechanism for constructing new instances of the document type.',
  additionalProperties: false,
  properties: {
    parameters: { /* edited out */ }
    implementation: { customTypeOf: 'function' } // <-- function inline with the JSON Schema.
  },
  required: ['parameters', 'implementation']
}

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-schemas --save

Usage

const { docTypeSchema, fieldTypeSchema, roleTypeSchema } = require('jsonotron-schemas')

console.log(docTypeSchema)
console.log(fieldTypeSchema)
console.log(roleTypeSchema)

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.

0.1.7

4 years ago

0.1.6

4 years ago

0.1.2

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago