-
-
Notifications
You must be signed in to change notification settings - Fork 160
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. |
Also needed support for this and did my own implementation: https://github.com/devidw/trpc-openapi It's a quick implementation, but if you would be interested in merging it into upstream I am happy to clean it up a bit and submit a PR. @jlalmes |
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):