blomqma / next-rest-framework

Type-safe, self-documenting APIs for Next.js
https://next-rest-framework.vercel.app
Other
134 stars 17 forks source link

Add paramsSchema to Route Operation input #154

Closed jameslshannon closed 4 months ago

jameslshannon commented 4 months ago

Looks like zod doesn't output descriptions for params decorated using describe(), so ideally we could also specify a paramsSchema (just like bodySchema and querySchema) so that additional openapi schema info can be added for params and therefore included in the generated oas file.

blomqma commented 4 months ago

Yeah having support for both the Zod describe method being included in the OpenAPI spec and an explicit JSON schema for the path parameters makes sense. I'm currently working on adding support for those in https://github.com/blomqma/next-rest-framework/pull/155. The only problem is that with pages router, Next.js includes both the path parameters and query parameters within the req.query object so we need separate validation for those with pages router as well.

blomqma commented 4 months ago

These changes are now published in v6.0.0-beta.3.