{"id":14986711,"url":"https://github.com/ahmadnassri/node-oas-fastify","last_synced_at":"2025-04-11T20:32:01.735Z","repository":{"id":37086856,"uuid":"281559985","full_name":"ahmadnassri/node-oas-fastify","owner":"ahmadnassri","description":"OAS 3.0 to Fastify routes automation","archived":false,"fork":false,"pushed_at":"2025-01-07T20:53:47.000Z","size":508,"stargazers_count":8,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T18:16:39.849Z","etag":null,"topics":["fastify","node","oas","openapi"],"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/ahmadnassri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ahmadnassri"]}},"created_at":"2020-07-22T03:01:20.000Z","updated_at":"2025-01-07T20:53:51.000Z","dependencies_parsed_at":"2024-06-17T22:02:58.480Z","dependency_job_id":"a3e0453f-a5d4-4919-83d2-9ff5f3d1f3a9","html_url":"https://github.com/ahmadnassri/node-oas-fastify","commit_stats":{"total_commits":412,"total_committers":7,"mean_commits":"58.857142857142854","dds":0.3058252427184466,"last_synced_commit":"f79ecd7b5703c036e62550d9b096ecb6f5dc9f67"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Fnode-oas-fastify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Fnode-oas-fastify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Fnode-oas-fastify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadnassri%2Fnode-oas-fastify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmadnassri","download_url":"https://codeload.github.com/ahmadnassri/node-oas-fastify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248068303,"owners_count":21042473,"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","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","node","oas","openapi"],"created_at":"2024-09-24T14:13:23.699Z","updated_at":"2025-04-11T20:31:56.718Z","avatar_url":"https://github.com/ahmadnassri.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ahmadnassri"],"categories":[],"sub_categories":[],"readme":"# OAS to Fastify Plugin\n\nOAS 3.x to Fastify routes automation\n\n[![license][license-img]][license-url]\n[![release][release-img]][release-url]\n[![super linter][super-linter-img]][super-linter-url]\n[![test][test-img]][test-url]\n[![semantic][semantic-img]][semantic-url]\n\n## Usage\n\n``` js\nconst fastify = require('fastify')()\nconst spec = require('./petstore.json')\n\n// your handler object properties map to the OAS \"operationId\"\nconst handler = {\n  listPets: () =\u003e { ... }\n  createPets: () =\u003e { ... }\n  showPetById: () =\u003e { ... }\n}\n\nfastify.register(require('oas-fastify'), { spec, handler }) \n```\n\n#### Yaml Support?\n\n\u003cdetails\u003e\n  \u003csummary\u003eThis package does not support OAS Yaml format, but you can easily convert to JSON before calling `oas-fastify`\u003c/summary\u003e\n\n###### using [`js-yaml`][]\n\n``` js\nconst yaml = require('js-yaml')\nconst fs   = require('fs')\n\nconst spec = yaml.safeLoad(fs.readFileSync('openapi.yml', 'utf8'))\n\n\nfastify.register(require('oas-fastify'), { spec, handler }) \n```\n\n###### using [`apidevtools/swagger-cli`][]\n\n``` bash\nnpx apidevtools/swagger-cli bundle spec/openapi.yml --outfile spec.json\n```\n\n\u003c/details\u003e\n\n### Options\n\nThe plugin accepts an `options` object with the following properties:\n\n-   **`spec`**: a valid [OpenAPI Specification][] **JSON** object\n-   **`handler`**: an object with properties that map to the spec's `operationId` names, with the values as functions that will handle the request\n\n###### Example\n\n``` js\nconst spec = {\n  \"paths\": {\n    \"/pets\": {\n      \"get\": {\n        \"operationId\": \"listPets\",\n        ...\n      }\n    }\n  }\n}\n\nconst handler = {\n  listPets: function (request, reply, fastify) {\n    // fastify instance passed in for convenience\n\n    reply.send({ hello: 'world' })\n  }\n}\n```\n\n  [`js-yaml`]: https://www.npmjs.com/package/js-yaml\n  [`apidevtools/swagger-cli`]: https://www.npmjs.com/package/@apidevtools/swagger-cli\n  [OpenAPI Specification]: https://github.com/OAI/OpenAPI-Specification/\n\n----\n\u003e Author: [Ahmad Nassri](https://www.ahmadnassri.com/) \u0026bull;\n\u003e Twitter: [@AhmadNassri](https://twitter.com/AhmadNassri)\n\n[license-url]: LICENSE\n[license-img]: https://badgen.net/github/license/ahmadnassri/node-oas-fastify\n\n[release-url]: https://github.com/ahmadnassri/node-oas-fastify/releases\n[release-img]: https://badgen.net/github/release/ahmadnassri/node-oas-fastify\n\n[super-linter-url]: https://github.com/ahmadnassri/node-oas-fastify/actions?query=workflow%3Asuper-linter\n[super-linter-img]: https://github.com/ahmadnassri/node-oas-fastify/workflows/super-linter/badge.svg\n\n[test-url]: https://github.com/ahmadnassri/node-oas-fastify/actions?query=workflow%3Atest\n[test-img]: https://github.com/ahmadnassri/node-oas-fastify/workflows/test/badge.svg\n\n[semantic-url]: https://github.com/ahmadnassri/node-oas-fastify/actions?query=workflow%3Arelease\n[semantic-img]: https://badgen.net/badge/📦/semantically%20released/blue\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadnassri%2Fnode-oas-fastify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmadnassri%2Fnode-oas-fastify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadnassri%2Fnode-oas-fastify/lists"}