# sequelize-json-schema **Repository Path**: mirrors_andyperlitch/sequelize-json-schema ## Basic Information - **Project Name**: sequelize-json-schema - **Description**: Use your Sequelize models in JSON Schemas or Swagger - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-12-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sequelize-json-schema Use your Sequelize models in JSON Schemas or Swagger Main use case for this code is to generate models for hand crafted swagger.json. ## Example ``` let Simple = sequelize.define('simple', { title: Sequelize.STRING, description: Sequelize.TEXT }); let def = definition(Simple); console.log(def); ``` And result will be: ``` { type: 'object', properties: { id: { type: 'integer', format: 'int32' }, title: { type: 'string' }, description: { type: 'string' }, createdAt: { type: 'string', format: 'date-time' }, updatedAt: { type: 'string', format: 'date-time' } } } ``` ## Using with Swagger This tool generates `definitions` part of the Swagger Manifest. So if you have Swagger definition for your API just extend `definitions` with JSON generated by this tool. ``` { "swagger": "2.0", "info": { "title": "API", "version": "1.0.0" }, "paths": { "simple": { "get": { "parameters": [ ], "responses": { "200": { "$ref": "#/definitions/simple" } } } } }, "definitions": { "simple": { type: 'object', properties: { id: { type: 'integer', format: 'int32' }, title: { type: 'string' }, description: { type: 'string' }, createdAt: { type: 'string', format: 'date-time' }, updatedAt: { type: 'string', format: 'date-time' } } } } } ``` ## LICENSE [MIT License](http://en.wikipedia.org/wiki/MIT_License)