{"id":19542619,"url":"https://github.com/fed135/swagger-route-validator","last_synced_at":"2025-04-26T17:31:20.103Z","repository":{"id":39794987,"uuid":"196018687","full_name":"fed135/swagger-route-validator","owner":"fed135","description":"The fastest route validation middleware","archived":false,"fork":false,"pushed_at":"2022-06-30T13:34:36.000Z","size":73,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T16:42:06.703Z","etag":null,"topics":["hacktoberfest","openapi","swagger","validation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fed135.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-09T13:53:03.000Z","updated_at":"2023-03-05T04:31:33.000Z","dependencies_parsed_at":"2022-08-29T22:50:05.814Z","dependency_job_id":null,"html_url":"https://github.com/fed135/swagger-route-validator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fed135%2Fswagger-route-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fed135%2Fswagger-route-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fed135%2Fswagger-route-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fed135%2Fswagger-route-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fed135","download_url":"https://codeload.github.com/fed135/swagger-route-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251025764,"owners_count":21524860,"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":["hacktoberfest","openapi","swagger","validation"],"created_at":"2024-11-11T03:15:20.518Z","updated_at":"2025-04-26T17:31:19.791Z","avatar_url":"https://github.com/fed135.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca title=\"Swagger Route Validator\" href=\"http://kalm.js.org\"\u003e\n    \u003cimg alt=\"logo\" width=\"300px\" src=\"./srv.png\" /\u003e\n    \u003cbr/\u003e\n  \u003c/a\u003e\n  Swagger Route Validator\n\u003c/h1\u003e\n\u003cbr/\u003e\n\n---\n\n- Extremely fast and 50% more efficient than [AJV](https://www.npmjs.com/package/ajv), the next fastest alternative\n- Zero dependencies :star:\n- Battle-tested by Fortune 500 companies\n- Supports most OpenAPI 3.0 features like $ref, $not, $anyOf, $allOf, $oneOf, etc.\n- Supports most common data formats like emails, ips, uuids, dates, etc.\n\n---\n\n## Usage\n\nThis is an example of an express middleware, which you could easily implement if you have your routes' swagger definitions.\n\n```javascript\nimport validate from 'swagger-route-validator';\n\n// Pass in the swagger spec for that route and return an express middleware\nexport default (routeSpec) =\u003e function validateRequest(req, res, next) {\n    // Check validation errors\n    const errors = validate(routeSpec, req);\n    if (errors.length \u003e 0) return res.status(400).json(errors);\n\n    next();\n};\n```\n\nIf you don't know in advance what route definition to use on an inbound request, you can follow [this example](https://gist.github.com/fed135/7a45eab6510a78a5d514fae9a5cb6734)\n\n## Running tests\n\n```\nnpm run test\n```\n\n## License\n\n[Apache 2.0](./LICENSE) - Frederic Charette\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffed135%2Fswagger-route-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffed135%2Fswagger-route-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffed135%2Fswagger-route-validator/lists"}