Skip to content

ronalddddd/sequelizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sequelizer

Build Status

Transform foreign schema definitions to Sequelize model definitions

Kind: global class

Sequelizer.fromJsonSchema(schemas, schemaId, options) ⇒ Object

Convert a JSON schema into a Sequelize model definition

See example/fromJsonSchema.js for example usage.

Kind: static method of Sequelizer
Returns: Object - The model definition to use with sequelize.define().

Param Type Description
schemas Object | Array A list of json schemas or a single Json schema object.
schemaId string | null The schema id to build the model definition from.
options
options.uniqueFields Array a list of fields that have the UNIQUE constraint
options.notNullFields Array a list of fields that have the NOT NULL constraint
options.mixinFields Array a list of properties that are sub-schemas (object or $ref types) to "flatten" into the model definition. For example, the schema property "address": { "$ref": "http://example.com/schemas/address" } will create "address" prefixed fields from the address sub-schema, resulting in model fields like "addressStreetName", "addressStreetNumber", etc.
options.customFieldDefinitions object Override the generated field definitions with your own. Field name to field definition mapping.

About

Transform JSON schemas into Sequelize Model definitions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published