Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

koa support or koa-openapi-validator

See original GitHub issue

Is your feature request related to a problem? Please describe. It would be awesome to have openapi validator for koa.

Describe the solution you’d like

  • adapt middleware to be koa compatible
  • make separated module koa-openapi-validator

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

cdimasciocommented, Jan 20, 2021

closing this out. beta is now available.

cdimasciocommented, Jan 18, 2021

@mahnunchik the beta prerelease is now available. please give it a try. let me know how it goes

Prerelease doc

See release documentation

Note: response validation and operation handlers are not supported (yet)


npm install koa-openapi-validator@4.12.0-beta.1

Sample app

const koa = require('koa');
const koaRouter = require('koa-router');
const OpenApiValidator = require('koa-openapi-validator');

const app = new koa();
const router = new koaRouter();

router.get('koala', '/v1/pets', (ctx) => {
  ctx.body = {
    message: 'Welcome! To the Koala Book of Everything!',

app.use(async (ctx, next) => {
  try {
    await next();
  } catch (err) {
    // console.error(err);
    ctx.status = err.statusCode || err.status || 500;
    ctx.body = {
      message: err.message,
      errors: err.errors ?? [],

    apiSpec: './openapi.yml',


app.listen(1234, () => console.log('running on port 1234'));


If you find bugs or run into problems, please file a new issue and mention the version 4.12.0-beta.xx

Read more comments on GitHub >

github_iconTop Results From Across the Web

koa-openapi-validator - npm
Automatically validate API requests with OpenAPI 3 and Koa.. Latest version: 4.12.0-beta.5, last published: 2 years ago.
Read more >
PayU/openapi-validator-middleware - GitHub
This package provides data validation within an Express, Koa or Fastify app according to a Swagger/OpenAPI definition. It uses Ajv under the hood...
Read more >
koa-openapi-validator: automatically validate requests with koa and ...
Express-openapi-validator - Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification.
Read more >
automatically validate requests with koa and openapi 3 (beta ...
koa -openapi-validator: automatically validate requests with koa and openapi 3 (beta prerelease). r/node - koa-openapi-validator: ...
Read more >
koa-router schema validation and swagger api doc generation
Koa is a webframework very similar to expressjs. Its not a complete webframework rather a middleware framework as it allows writing middlewares ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found