New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

json-schema-models

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-models

json schema based models

  • 0.6.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

json-schema-models

build status Current Version dependency Status devDependency Status Coveralls

Data models for mongodb using json schema to define polymorphic schemas to be used with mongodb. Internally modules use z-schema for json validation and mongodb native driver to connect to db.

Not currently fit for public consumption

API
new jsonSchemaModels(options);

options object must contain the following properties

  • mongo

    • name - mongodb name
    • url - mongodb url string (host and port)
    • options - mongodb connection options
    • collections - an array of objects with name, indexes (for createIndexes method) and options properties to pass to mongodb createCollection method
  • schema

    • formats - an object with keys being name of format to register and value being the custom function to register for z-schema validation
.addSchemas(schemas)
  • method to addSchemas prior to connecting to database, schemas can be an object with keys being records and definitions and the values being key of schema name and value the schema object to loaded
.start(callback)
  • method to validate the schemas

    params
    • callback with error, result signature - error will show if any schemas have failed validation and result is an object containing the raw mognodb db handle from connection and an object containing handles to each model and each collection created.
.stop(callback)
  • method to close connections and clean-up for server closedown

    params
    • optional callback with no signature
.buildIndexes(callback)
  • method to build indexes based on schema definitions

    params
    • callback with err signature
Todo
  • Intergrate dropAllIndexes method
  • Handle multi-tenant database semantics
  • Switch to promises, generators or async await instead of neo-async dependency

FAQs

Package last updated on 28 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc