Open jneuendorf-i4h opened 1 year ago
Hi,
while working with your router, I came up with the following type declaration:
declare module "koa-router-ajv-swaggergen" { import KoaRouter from "@koa/router" import { JSONSchemaType } from "ajv" // type SchemaRouterMethod = "del" | "get" | "post" | "put" type Handler = | (( this: Router, path: string, schema: JSONSchemaType<any>, ...handlers: KoaRouter.Middleware[] ) => ReturnType<KoaRouter.Middleware>) // | (( // this: Router, // path: string, // config: { schema?: object; pre?: KoaRouter.Middleware[] }, // ...handlers: KoaRouter.Middleware[] // ) => ReturnType<KoaRouter.Middleware>) export default class Router { rootDoc: { openapi: string info: { title: string description: string version: string } tags: string[] servers: string[] } constructor(router: KoaRouter, prefix: string) routes: KoaRouter["routes"] use: KoaRouter["use"] prefix: KoaRouter["prefix"] param: KoaRouter["param"] allowedMethods: KoaRouter["allowedMethods"] get( path: string, schema: JSONSchemaType<any>, ...handlers: KoaRouter.Middleware[] ): ReturnType<KoaRouter.Middleware> // get: Handler post: Handler put: Handler del: Handler } export function setupJsonErrors(app: any): void }
Maybe, this is useful for you. ;)
I really appreciate your help. I hope to integrate this soon and perhaps add some documentation.
Hi,
while working with your router, I came up with the following type declaration:
Maybe, this is useful for you. ;)