{"id":14989345,"url":"https://github.com/ron96g/koa-x-oapi-validator","last_synced_at":"2026-02-10T01:01:20.414Z","repository":{"id":84423395,"uuid":"606567930","full_name":"ron96G/koa-x-oapi-validator","owner":"ron96G","description":"Koa port of the popular express-openapi-validator library.","archived":false,"fork":false,"pushed_at":"2023-09-29T19:31:41.000Z","size":345,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-09T09:37:35.743Z","etag":null,"topics":["koa","middleware","nodejs","openapi","openapi-3","request-validation","response-validation","swagger"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ron96G.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-02-25T21:55:19.000Z","updated_at":"2023-02-28T11:29:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"44e2e700-3d75-43c0-8ea4-b3d431cdf414","html_url":"https://github.com/ron96G/koa-x-oapi-validator","commit_stats":{"total_commits":26,"total_committers":3,"mean_commits":8.666666666666666,"dds":0.3846153846153846,"last_synced_commit":"433a4ec51bc77677524e7cafa9da7fa7dffc4046"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ron96G/koa-x-oapi-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fkoa-x-oapi-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fkoa-x-oapi-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fkoa-x-oapi-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fkoa-x-oapi-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ron96G","download_url":"https://codeload.github.com/ron96G/koa-x-oapi-validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fkoa-x-oapi-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29287694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T21:57:15.303Z","status":"ssl_error","status_checked_at":"2026-02-09T21:57:11.537Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["koa","middleware","nodejs","openapi","openapi-3","request-validation","response-validation","swagger"],"created_at":"2024-09-24T14:18:09.994Z","updated_at":"2026-02-10T01:01:16.809Z","avatar_url":"https://github.com/ron96G.png","language":"TypeScript","readme":"Koa port of the popular [express-openapi-validator](https://www.npmjs.com/package/express-openapi-validator) library.\nSee [Intention](#intention)\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./docs/overview.png\"\u003e\n\u003c/div\u003e\n\n# Intention\n\nI was looking for a OpenAPI validation middleware solution for Koa. However, I was unable to find anything that (a) had the required functionality and (b) was actively maintained.\nTherefore, I wrote this library as a port to the popular [express-openapi-validator](https://www.npmjs.com/package/express-openapi-validator) which satisfies the requirements and with which I have worked before.\n\nThis does come with some drawbacks as the solution used in express-openapi-validator has been tailored for express and thus is not useable as [koa-openapi-validator](https://www.npmjs.com/package/koa-openapi-validator) shows.\n\nIf there is any solution for Koa that is sufficient, I would recommend using this instead of this.\n\n# Usage\n\nThis library should be integrated as a normal Koa middleware.\nError-Handling and everything else should be done the normal \"Koa way\".\n\n1. Install the library\n\n```bash\nnpm i koa-x-oapi-validator\n```\n\n2. Initialize the middleware\n\n```ts\nconst validator = new KoaOpenAPIValidator({\n  apiSpec: OPENAPI_SPEC,\n  validateRequests: true,\n  validateResponses: true,\n});\nconst validatorMw = validator.use();\n```\n\n3. Use the middleware\n\n```ts\nrouter.post('/hello', validatorMw, async (ctx: Koa.Context) =\u003e {\n  ctx.status = 200;\n  ctx.body = {\n    message: 'Hello World!',\n  };\n});\n```\n\n# Debugging\n\nTo enable debug logging set the environment variable `DEBUG=validator.*` (see [debug](https://www.npmjs.com/package/debug)).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fron96g%2Fkoa-x-oapi-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fron96g%2Fkoa-x-oapi-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fron96g%2Fkoa-x-oapi-validator/lists"}