{"id":14986716,"url":"https://github.com/alt3/sequelize-to-json-schemas","last_synced_at":"2025-10-17T17:40:04.659Z","repository":{"id":45384116,"uuid":"200357141","full_name":"alt3/sequelize-to-json-schemas","owner":"alt3","description":"Convert Sequelize models into various JSON Schema variants (using the Strategy Pattern)","archived":false,"fork":false,"pushed_at":"2021-12-18T17:30:51.000Z","size":352,"stargazers_count":35,"open_issues_count":6,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-09T19:35:48.246Z","etag":null,"topics":["javascript","json-schema","oas","oas2","openapi","sequelize","strategy-pattern","swagger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alt3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-03T09:29:20.000Z","updated_at":"2024-11-14T13:16:16.000Z","dependencies_parsed_at":"2022-08-20T16:50:32.871Z","dependency_job_id":null,"html_url":"https://github.com/alt3/sequelize-to-json-schemas","commit_stats":null,"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"purl":"pkg:github/alt3/sequelize-to-json-schemas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt3%2Fsequelize-to-json-schemas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt3%2Fsequelize-to-json-schemas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt3%2Fsequelize-to-json-schemas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt3%2Fsequelize-to-json-schemas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alt3","download_url":"https://codeload.github.com/alt3/sequelize-to-json-schemas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt3%2Fsequelize-to-json-schemas/sbom","scorecard":{"id":187006,"data":{"date":"2025-08-11","repo":{"name":"github.com/alt3/sequelize-to-json-schemas","commit":"9ebb44d663e7b16ea03a3b6394df67260e065846"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T19:57:58.600Z","repository_id":45384116,"created_at":"2025-08-16T19:57:58.600Z","updated_at":"2025-08-16T19:57:58.600Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279126039,"owners_count":26109268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","json-schema","oas","oas2","openapi","sequelize","strategy-pattern","swagger"],"created_at":"2024-09-24T14:13:24.204Z","updated_at":"2025-10-17T17:40:04.644Z","avatar_url":"https://github.com/alt3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM Version](https://img.shields.io/npm/v/@alt3/sequelize-to-json-schemas?style=flat-square)](https://www.npmjs.com/package/@alt3/sequelize-to-json-schemas)\n[![Build Status](https://img.shields.io/travis/alt3/sequelize-to-json-schemas/master.svg?style=flat-square)](https://app.travis-ci.com/alt3/sequelize-to-json-schemas)\n[![Known Vulnerabilities](https://snyk.io/test/github/alt3/sequelize-to-json-schemas/badge.svg)](https://snyk.io/test/github/alt3/sequelize-to-json-schemas)\n![NPM Total Downloads](https://img.shields.io/npm/dt/@alt3/sequelize-to-json-schemas.svg?style=flat-square)\n[![Code Coverage](https://img.shields.io/codecov/c/github/alt3/sequelize-to-json-schemas.svg?style=flat-square)](https://codecov.io/gh/alt3/sequelize-to-json-schemas)\n[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/alt3/sequelize-to-json-schemas?style=flat-square)](https://codeclimate.com/github/alt3/sequelize-to-json-schemas)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](https://www.contributor-covenant.org/version/2/0/code_of_conduct)\n\n# sequelize-to-json-schemas\n\nConvert Sequelize models into these JSON Schema variants (using the Strategy Pattern):\n\n- JSON Schema Draft-07 - [sample output](examples/json-schema-v7.md)\n- OpenAPI 3.0 - [sample output](examples/openapi-v3.md)\n\nCompatible with Sequelize versions 4, 5 and 6.\n\n## Main Goals\n\n- understandable code, highly maintainable\n- valid schemas (enforced by the [ajv](https://github.com/epoberezkin/ajv) and [Swagger Parser](https://github.com/APIDevTools/swagger-parser) validators)\n- JsonSchemaManager for single (rock solid) core functionality shared between all strategies\n- StrategyInterface for simplified implementation of new schema variants\n\n\u003e Feel free to PR strategies for missing schemas\n\n## Installation\n\n```bash\nnpm install @alt3/sequelize-to-json-schemas --save\n```\n\n## Usage\n\n\u003c!-- prettier-ignore-start --\u003e\n```javascript\nconst { JsonSchemaManager, JsonSchema7Strategy, OpenApi3Strategy } = require('@alt3/sequelize-to-json-schemas');\nconst schemaManager = new JsonSchemaManager();\n\n// now generate a JSON Schema Draft-07 model schema\nlet schema = schemaManager.generate(userModel, new JsonSchema7Strategy());\n\n// and/or the OpenAPI 3.0 equivalent\nschema = schemaManager.generate(userModel, new OpenApi3Strategy());\n```\n\u003c!-- prettier-ignore-end --\u003e\n\n## Configuration Options\n\nTo configure global options use the JsonSchemaManager initialization:\n\n```javascript\nconst schemaManager = new JsonSchemaManager({\n  baseUri: '/',\n  absolutePaths: true,\n  secureSchemaUri: true,\n  disableComments: true,\n});\n```\n\nTo configure (per) model options use the `generate()` method:\n\n```javascript\nconst userSchema = schemaManager.generate(userModel, strategy, {\n  title: 'Custom model title',\n  description: 'Custom model description',\n  exclude: ['someAttribute'],\n  include: ['someAttribute'],\n  associations: true,\n  excludeAssociations: ['someAssociation'],\n  includeAssociations: ['someAssociation'],\n});\n```\n\nThe following Sequelize attribute options are automatically converted into\nschema properties:\n\n```javascript\nmodule.exports = (sequelize) =\u003e {\n  const model = sequelize.define('user', {\n    userName: {\n      type: DataTypes.STRING,\n      allowNull: true,\n      defaultValue: 'Default Value',\n      associate: {},\n    },\n  });\n\n  return model;\n};\n```\n\nTo configure additional schema properties add a `jsonSchema` property with\none or more of the following custom options to your Sequelize attribute:\n\n```javascript\nmodule.exports = (sequelize) =\u003e {\n  const model = sequelize.define('user', {\n    userName: {\n      type: DataTypes.STRING,\n      jsonSchema: {\n        description: 'Custom attribute description',\n        comment: 'Custom attribute comment',\n        examples: ['Custom example 1', 'Custom example 2'],\n        readOnly: true, // OR writeOnly: true\n      },\n    },\n  });\n\n  return model;\n};\n```\n\nIn order to create a valid output for `JSON` columns, or to otherwise override\nthe schema output for a particular sequelize attribute, add a `schema` attribute:\n\n```javascript\nmodule.exports = (sequelize) =\u003e {\n  const model = sequelize.define('user', {\n    // ...\n    settings: {\n      type: DataTypes.JSON,\n      jsonSchema: {\n        schema: { type: 'object' },\n      },\n    },\n  });\n\n  return model;\n};\n```\n\n## Framework Integrations\n\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/alt3/sequelize-to-json-schemas/issues/17\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/feathersjs/docs/master/.vuepress/public/img/logo-title.jpg\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003ch3\u003eFeathers\u003c/h3\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## License\n\nThis project is released under [MIT LICENSE](LICENSE.txt).\n\n## Contributing\n\nPlease refer to the [guidelines for contributing](./contributing.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt3%2Fsequelize-to-json-schemas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falt3%2Fsequelize-to-json-schemas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt3%2Fsequelize-to-json-schemas/lists"}