Menu

koa-okapi-router: OpenAPI for Koa, without the migration hangover
📰

koa-okapi-router: OpenAPI for Koa, without the migration hangover

DEV Community: koa·Sven Johansson·8 months ago
#3LRCg73C
#devtokoa#devto#dev#openapi#router
Long article (1425 words) — no AI summary yet.
Reading 0:00
15s threshold

Last night I published version 0.1.4 of koa-okapi-router - a small project that grew out of repeated frustration while working on a microservice-heavy platform with a lot of HTTP services.

The codebase is written in TypeScript. While Koa itself (and most popular middleware) have decent type definitions, the central piece - the Koa Context - effectively remains untyped at the edges. Requests arrive as loosely structured blobs where path params, query params, and request bodies all default to any or unknown .

In JavaScript , where Koa comes from, this is fine. In TypeScript , it sticks out. Even in codebases with otherwise good type hygiene, this creates a blind spot right at the system boundary.

The other recurring pain point is OpenAPI and Swagger . It introduces yet another source of truth that has to be kept in sync with runtime behavior.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.