Southclaws / supervillain

Converts Go structs to Zod schemas
MIT License
77 stars 6 forks source link

Accept custom schemas via a ZodSchema() method #10

Closed josiah-tt closed 11 months ago

josiah-tt commented 11 months ago

Passing a centralized map of custom schema functions to NewConverter() separates the custom schema definition from its type. Sometimes this is necessary (as in the shopspring/decimal.Decimal example), but when the supervillain user has control over the type that needs a custom schema, it's nicer to define a method that returns the schema.

New examples are included in the custom/ directory.

Southclaws commented 11 months ago

Really nice, thanks!