Closed max06 closed 7 months ago
It's me, thinking too complicated 🙈
registry.registerPath({
method: "get",
path: "/projects",
description: "Get all projects",
summary: "Get all projects",
responses: {
200: {
description: "List with Projects",
content: {
"application/json": {
schema: {
type: "array",
items: {
$ref: "#/components/schemas/Project",
},
},
},
},
},
},
parameters: [{ $ref: "#/components/parameters/simulate" }],
});
Just in case someone else is looking for that.
Hello there - great project!
I have a large directory with a lot of already defined zod schemas. It would be really easy to run
registry.register
on all of these to build up a schema collection.My issue:
registry.registerPath
requires me to reference those schemas again. If possible I'd love to use something likeregistry.definitions("someRegisteredSchema")
instead to avoid adding a whole lot of references that basically already exist.UseCase/Example: We're building a nuxt application with layers, where our schema definitions are in a different layer. Our user-facing api offers dynamic route handlers like
/api/projects/[projectId]/[resourceType]
auto-loading the matching schema forresourceType
. It would be way easier to just define the response using that resourceType-String, like "it returns an array of type Server".Or I'm thinking to complicated, not sure yet.