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.
Passing a centralized map of custom schema functions to
NewConverter()
separates the custom schema definition from its type. Sometimes this is necessary (as in theshopspring/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.