Replies: 1 comment
-
Ideally schemas can be built and re-used across multiple routes. I'd be fine with defining things like security schemes and other one-time setup components in the config. If we can use evaluated code in defineRouteMeta (#2974) then we can perhaps have components defined as Zod schemas (with zod-openapi) and registered using something like what you are describing, then use the references in our route meta. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really liked the
defineRouteMeta()
approach for documenting the API, but I'm curious about how it will handle thecomponents
and other global objects in the future.Currently, it probably will looks something like this:
I'm not sure if placing it all in
nitro.config.ts
is the best idea because it will increase the file size when new Schemas, Parameters, RequestBodies...etc, entities number grow.One possibility could be something like this, similar to the custom error handler:
This way, the configuration is isolated and treat all OpenAPI concerns. What you guys think?
Beta Was this translation helpful? Give feedback.
All reactions