JSON Schema to ReQL translator


License
Apache-2.0
Install
npm install reql-schema@0.1.0-support-secondary-indexes-18d351891f20164337f93b4081bba84c4cba7a65

Documentation

ReQL Schema

Query RethinkDB with (a subset of) JSON Schema.

Installation

Install reql-schema by running:

npm install --save reql-schema

Documentation

const rethinkdb = require('rethinkdb')
const reqlSchema = require('reql-schema')

const connection = await rethinkdb.connect({ ... })
const cursor = await reqlSchema('myDb', 'myTable', {
	type: 'object',
	required: [ 'foo' ],
	properties: {
		foo: {
			type: 'string'
		}
	}
}).run(connection)

const array = await cursor.toArray()
console.log(array)

The following JSON Schema properties have been implemented:

  • type
  • const
  • pattern
  • format (supports uuid, email, and date-time)
  • minimum
  • maximum
  • enum
  • contains
  • allOf
  • anyOf
  • not

Tests

Run the following command:

npm test

Contribute

Before submitting a PR, please make sure that you include tests, and that the linter runs without any warning:

npm run lint

Support

If you're having any problem, please raise an issue on GitHub.

License

This project is free software, and may be redistributed under the terms specified in the license.