google / cddlconv

A commandline utility for converting CDDL to various formats.
Apache License 2.0
9 stars 0 forks source link

Add an option to specify which object types have to be passthrough #23

Closed OrKoN closed 6 months ago

OrKoN commented 6 months ago

Sometimes there is an need for some objects to allow extra attributes via .passthrough(). There should be an option to specify which types need to call passthrough for zod.

OrKoN commented 6 months ago

cc @jrandolf

OrKoN commented 6 months ago

Alternatively, we should use passthrough on all objects to closer match cddl.

jrandolf-2 commented 6 months ago

Using passthrough would be an implementation detail. CDDL doesn't specify anything regarding extra attributes. In particular, users' should rely strictly on what the CDDL specifies.

From looking at the issue, making sure the order of productions is correct should fix the problem. See https://github.com/colinhacks/zod?tab=readme-ov-file#unions