hapi-json-schema

json schema models for mongodb

Usage no npm install needed!

<script type="module">
  import hapiJsonSchema from 'https://cdn.skypack.dev/hapi-json-schema';
</script>

README

hapi-json-schema

Greenkeeper badge build status Current Version dependency Status devDependency Status Coveralls

Hapi plugin for json-schema-models

options object must contain the following properties

  • indexes - boolean to confirm whether indexes should be built or not
  • mongo
    • name - mongodb name
    • url - mongodb url string (host and port)
    • options - mongodb connection options
    • collections - array of objects with following properties
      • name - string name of collection
      • indexes - array of indexes to create
      • options - valid options object for mongodb driver createCollection method
  • schemata - directory containing schemas
  • formats - path to formats file

Plugin exposes 2 methods

addSchemas via server.dataStore.schema.addSchemas
addFormats via server.dataStore.schema.addFormats

These methods can be used by other plugins to dynamically load more internal schema / models

Todo
  • Improve interface to z-schema
  • Manage plugin dependencies better