{"id":15493845,"url":"https://github.com/seriousme/fastify-swaggergen","last_synced_at":"2026-03-07T23:31:54.108Z","repository":{"id":52016515,"uuid":"131607150","full_name":"seriousme/fastify-swaggergen","owner":"seriousme","description":"generate fastify routes from a swagger specification","archived":false,"fork":false,"pushed_at":"2021-05-08T07:17:49.000Z","size":861,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T06:08:06.612Z","etag":null,"topics":["fastify","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/seriousme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-30T14:39:04.000Z","updated_at":"2023-08-24T16:16:36.000Z","dependencies_parsed_at":"2022-08-24T12:10:18.706Z","dependency_job_id":null,"html_url":"https://github.com/seriousme/fastify-swaggergen","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/seriousme/fastify-swaggergen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousme%2Ffastify-swaggergen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousme%2Ffastify-swaggergen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousme%2Ffastify-swaggergen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousme%2Ffastify-swaggergen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seriousme","download_url":"https://codeload.github.com/seriousme/fastify-swaggergen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriousme%2Ffastify-swaggergen/sbom","scorecard":{"id":812694,"data":{"date":"2025-08-11","repo":{"name":"github.com/seriousme/fastify-swaggergen","commit":"c5a0db4145b6e0b6b6c2328a15f64822899a166e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"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":"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":"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":10,"reason":"no dangerous workflow patterns detected","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":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs-ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/seriousme/fastify-swaggergen/nodejs-ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs-ci.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/seriousme/fastify-swaggergen/nodejs-ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"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":"Code-Review","score":0,"reason":"Found 0/12 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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs-ci.yml:1","Info: no jobLevel write permissions found"],"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":"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":"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"}},{"name":"Vulnerabilities","score":0,"reason":"30 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-3fjj-p79j-c9hh","Warn: Project is vulnerable to: GHSA-p6vg-p826-qp3v","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-qgmg-gppg-76g5","Warn: Project is vulnerable to: GHSA-xx4c-jj58-r7x6","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T13:32:18.632Z","repository_id":52016515,"created_at":"2025-08-23T13:32:18.633Z","updated_at":"2025-08-23T13:32:18.633Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30237329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T23:24:20.706Z","status":"ssl_error","status_checked_at":"2026-03-07T23:21:10.486Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fastify","swagger"],"created_at":"2024-10-02T08:09:40.655Z","updated_at":"2026-03-07T23:31:54.085Z","avatar_url":"https://github.com/seriousme.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fastify swagger generator\n[![CI status](https://github.com/seriousme/fastify-swaggergen/workflows/Node.js%20CI/badge.svg)](https://github.com/seriousme/fastify-swaggergen/actions?query=workflow%3A%22Node.js+CI%22)\n\nA plugin for [fastify](https://www.fastify.io) to autogenerate a configuration based on a [OpenApi](https://www.openapis.org/)(v2/v3) specification.\n\n\n----\n# This project has been replaced by [Fastify OpenApi Glue](https://github.com/seriousme/fastify-openapi-glue)\n\n----\n\n\u003ca name=\"install\"\u003e\u003c/a\u003e\n## Install: \n```\nnpm i fastify-swaggergen --save\n```\n\u003ca name=\"plugin\"\u003e\u003c/a\u003e\n## Plugin\n\u003ca name=\"pluginUsage\"\u003e\u003c/a\u003e\n### Usage\n\nAdd the plugin to your project with `register` and pass it some basic options and you are done !\n```javascript\nconst swaggerGen = require(\"fastify-swaggergen\");\n\nconst options = {\n  swaggerSpec: `${__dirname}/petstore-swagger.v2.json`,\n  service: `${__dirname}/service.js`,\n  fastifySwagger: {\n    disabled: false\n  }\n};\n\n\nfastify.register(swaggerGen, options);\n```\n\nAll schema and routes will be taken from the OpenApi specification listed in the options. No need to specify them in your code. \n\u003ca name=\"pluginOptions\"\u003e\u003c/a\u003e\n### Options\n  - `swaggerSpec`: this can be a JSON object, or the name of a JSON or YAML file containing a valid OpenApi(v2/v3) file \n  - `service`: this can be a javascript object or class, or the name of a javascript file containing such an object. If the import of the file results in a function instead of an object then the function will be executed during import.\n  - `fastifySwagger`: an object containing the options for the [fastify-swagger](https://github.com/fastify/fastify-swagger) plugin. To avoid registering this plugin pass `{ fastifySwagger: { disabled: true }}`\n\nOf these options `swaggerSpec` and `service` are mandatory, `fastifySwagger` is optional.\n\nSee the [examples](#examples) section for a demo.\n\u003ca name=\"generator\"\u003e\u003c/a\u003e\n## Generator\n\nTo make life even more easy there is the `swaggergen` cli. The `swaggergen` cli takes a valid OpenApi (v2/v3) file (JSON or YAML) and generates a project including a fastify flugin that you can use on any fastify server, a stub of the service class and a skeleton of a test harness to test the plugin. \n\n\u003ca name=\"generatorUsage\"\u003e\u003c/a\u003e\n### Usage\n```\n  swaggergen [options] \u003cOpenApi specification\u003e\n```\nor if you don't have `swaggergen` installed:\n```\n  npx github:seriousme/fastify-swaggergen \u003cOpenApi specification\u003e\n```\nThis will generate a project based on the provided OpenApi specification.\nAny existing files in the project folder will be overwritten!\nSee the [generator examples](#examples) section for a demo.\n\u003ca name=\"generatorOptions\"\u003e\u003c/a\u003e\n### Options:\n```\n\n  -p \u003cname\u003e                   The name of the project to generate\n  --projectName=\u003cname\u003e        [default: generatedProject]\n\n  -b \u003cdir\u003e --baseDir=\u003cdir\u003e    Directory to generate the project in.\n                              This directory must already exist.\n                              [default: \".\"]\n\nThe following options are only usefull for testing the swaggergen plugin:\n  -c --checksumOnly           Don't generate the project on disk but\n                              return checksums only.\n  -l --localPlugin            Use a local path to the plugin.\n```\nSee the [generator example](#generatorExamples) section for a demo.\n\n\u003ca name=\"examples\"\u003e\u003c/a\u003e\n## Examples\nClone this repository and run `npm i` \n\n\u003ca name=\"pluginExamples\"\u003e\u003c/a\u003e\n### Plugin\nExecuting `npm start` will start fastify on localhost port 3000 with the\nroutes extracted from the [petstore example](examples/petstore/petstore-swagger.v2.json) and the [accompanying service definition](examples/petstore/service.js)\n\n* http://localhost:3000/documentation will show the swagger UI, for comparison one could look\n  at http://petstore.swagger.io/\n* http://localhost:3000/v2/pet/24 will return a pet as specified in service.js\n* http://localhost:3000/v2/pet/myPet will return a fastify validation error:\n\n```json\n{\n  \"statusCode\": 400,\n  \"error\": \"Bad Request\",\n  \"message\": \"params.petId should be integer\"\n}\n```\n\n* http://localhost:3000/v2/pet/findByStatus?status=a\u0026status=b will return\n  the following error:\n\n```json\n{\n  \"statusCode\": 500,\n  \"error\": \"Internal Server Error\",\n  \"message\": \"Operation findPetsByStatus not implemented\"\n}\n```\n\n* http://localhost:3000/v2/pet/0 will return the following error:\n\n```json\n{\n  \"statusCode\": 500,\n  \"error\": \"Internal Server Error\",\n  \"message\": \"name is required!\"\n}\n```\n\nas the pet returned by service.js does not match the response schema.\n\n\u003ca name=\"generatorExamples\"\u003e\u003c/a\u003e\n### Generator\nThe folder [examples/generatedProject](examples/generatedProject) contains the result of running `swaggergen -l --baseDir=examples examples/petstore/petstore-swagger.v2.yaml`. The generated code can be started using `npm start` in `examples/generatedProject` (you will need to run `npm i` in the generated folder first)\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n\n\n# License\nLicensed under [MIT](license.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriousme%2Ffastify-swaggergen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseriousme%2Ffastify-swaggergen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriousme%2Ffastify-swaggergen/lists"}