astahmer / openapi-zod-client

Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml)
openapi-zod-client.vercel.app
717 stars 80 forks source link

fix #260 to reproduce https://editor.swagger.io/ behavior when cope with required only allOf item #261

Closed C-ra-ZY closed 7 months ago

C-ra-ZY commented 8 months ago

This is an attempt to fix https://github.com/astahmer/openapi-zod-client/issues/260

Now getZodSchema would try to infer items in a required only item with sibling in the same allOf array. and eliminate extra items in required array when there is no where to inter them, just like what swagger editor does.

However, even I myself feel that this solution is too specific to cases like 'required only item' and lacks generality. It seems more like a patch than a fix from real cause of this issue. I don't expect this pull request to be accepted, I just hope it can contribute some insights to those attempting to address this issue and provide ideas for a more comprehensive solution.

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
openapi-zod-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 27, 2023 3:09am
astahmer commented 7 months ago

thank you for your work ! 🙏