StefanTerdell / json-schema-to-zod

ISC License
322 stars 46 forks source link

"oneOf" as union? #78

Closed davedoesdev closed 9 months ago

davedoesdev commented 9 months ago

Could oneOf be represented as union instead of a refined any? It would make the output read better and better suited to further processing.

StefanTerdell commented 9 months ago

No, oneOf is exclusive, union is inclusive. Use anyOf in the JSON schema instead, using oneOf is almost universally a bad idea.

davedoesdev commented 9 months ago

Thanks, that works for my use case :+1: