ts-rest / ts-rest

RPC-like client, contract, and server implementation for a pure REST API
https://ts-rest.com
MIT License
2.11k stars 91 forks source link

Generate JSON $refs for repetitive schema #610

Open lukashroch opened 2 weeks ago

lukashroch commented 2 weeks ago

While using open API generation I've stumbled open the issue that our output file grows into huge size for complex type every time it's referenced in schema and realizing that all JSON schemas are being embedded without reference.

Is there a way to use open API generation to generate some parts with JSON schema as $refs for re-use to limit repetition / and keep the file smaller/manageable? E.g. mark them on zod/open-api with some $ref tag for extraction to separate file and reference in main schema?