New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Model Schemas to OpenApi Docs #417
base: master
Are you sure you want to change the base?
Conversation
Can this work with other generators notably https://github.com/samchungy/zod-openapi? |
I don't see why not -- it should work as long as the generator embeds a reference ID somewhere in the object definition, which a cursory glance at I might take it upon myself to test it in the next few days, but it would almost certainly work. |
That'd be awesome. samchungy's version is an evolution of the @asteasolutions/zod-to-openapi one |
Just found this fork and it seems to work like a charm! |
https://github.com/lilyrose2798/trpc-openapi Wonder if the two PRs overlap / can be used together or are there conflicting ideas? |
@calasanmarko can you look take a look at the fork from @LilyRose2798 too? Seems to contain the same functionalities but more robust and supports optional schema registration. |
From issue #157 :
I needed a way to integrate my OpenAPI-extended Zod schemas (using
@asteasolutions/zod-to-openapi
) with the rest of the document generated bytrpc-openapi
, so I threw this together in an afternoon.This implementation integrates a registry of Zod schemas into the final document, and also links return, parameter, and request body types of tRPC procedures with these schemas.
A minimal example of how this looks with
@asteasolutions/zod-to-openapi
(although it should work with any solution):