express-openapi icon indicating copy to clipboard operation
express-openapi copied to clipboard

Use TypeScript request handler definition to generate route description

Open hubgit opened this issue 4 years ago • 1 comments

The generic TypeScript description for express.RequestHandler allows type definitions for the request path params, response body, request body and request query params:

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/03fa4ecc7ecbe94e50b5e5fe03d7add64a198198/types/express-serve-static-core/index.d.ts#L53-L66

Would it be possible to make use of these when generating the OpenAPI description for a route?

hubgit avatar Mar 11 '21 20:03 hubgit

Yes, I do think that is the right way to do this. Happy to accept a PR for this.

wesleytodd avatar Mar 31 '21 03:03 wesleytodd