Socket
Socket
Sign inDemoInstall

json-schema-to-db-model-core

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-to-db-model-core

Core functionality to create database models from json schema


Version published
Maintainers
1
Created
Source

json-schema-to-db-model-core

Core functions to create Sequelize database models (http://docs.sequelizejs.com/manual/tutorial/models-definition.html) from json schema (https://json-schema.org/).

Usage:

npm install --save json-schema-to-db-model-core

const { createModelFiles } = require("json-schema-to-db-model-core");
const schema = require("./schema);

createModelFiles(schema, "models");

Requirements:

Node v8.9+

Testing:

To run the unit tests you'll need to clone the git repo, then run npm ci, npm test

Improvements - The following are on the to do list:

  • Validate input schema before attempting to create models
  • Add default validation functions from json schema to the model definitions
  • Support Array data type
  • Support NoSQL database
  • Support an ORM other than Sequelize, or create raw SQL output

Limitations - The following are not planned to be worked on due to limitations in the fundamental nature of json schema or a database model:

  • Only supports single data types in schema. This means you cannot define a field as having potential multiple types, which json schema allows. This could be revisited for a NoSQL database.
  • Only supports "belongsTo" relationship. This is the most obvious relationship to implemenent from json schema definition. Further relationship types would require additions to the information held in json schema, so will not be looking to add this for now.

FAQs

Package last updated on 12 Nov 2018

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