[x] I have looked at the documentation here first?
[x] I have looked at the examples provided that may showcase my question here?
Package version eg. v9, v10: v10
Issue, Question or Enhancement:
I'm trying to write a validator that operates on a type definition (newtype) of a slice of some type T. The reason for this is I want to assert some data that depends on a reduction operation of the items within the slice.
Now I could make this alias into a struct that contains a field but that's going to involve changing a metric ton of code that depends on this structure, it's also an API contract so our JSON interface would have to change too.
I want to keep the validation for this type isolated to just this type as the list of items type is used for many other things so it would be arduous to re-implement this validation layer at the container layer (the structs that contain the list).
Package version eg. v9, v10: v10
Issue, Question or Enhancement:
I'm trying to write a validator that operates on a type definition (newtype) of a slice of some type T. The reason for this is I want to assert some data that depends on a reduction operation of the items within the slice.
Now I could make this alias into a struct that contains a field but that's going to involve changing a metric ton of code that depends on this structure, it's also an API contract so our JSON interface would have to change too.
I want to keep the validation for this type isolated to just this type as the list of items type is used for many other things so it would be arduous to re-implement this validation layer at the container layer (the structs that contain the list).
Code sample, to showcase or reproduce:
https://go.dev/play/p/D9iZePnD-bA