Follow the same structure as SetFields, instead of copying fields(terminal paths) - validate it according to the annotations.
If no fields are specified to ValidateFields (i.e. it's called as ValidateFields()), all fields are validated.
This lets ValidateFields have the same recursive structure as SetFields
What can you do yourself and what do you need help with?
I will add basic Validate method implementation and extend goType.
@KrishnaIyer will then take over and add actual validator tags and their implementation as needed
Summary:
The plugin should generate a
func (*T) ValidateFields(...string) error
method for each message. Required by https://github.com/TheThingsNetwork/lorawan-stack/issues/51What is already there? What do you see now?
Only
SetFields
What is missing? What do you want to see?
func (*T) ValidateFields(...string) error
How do you propose implementing this?
Follow the same structure as
SetFields
, instead of copying fields(terminal paths) - validate it according to the annotations. If no fields are specified toValidateFields
(i.e. it's called asValidateFields()
), all fields are validated. This letsValidateFields
have the same recursive structure asSetFields
The validation tags in protos could look the same as https://github.com/lyft/protoc-gen-validate In fact, we could reuse the tag definitions they already have.
What can you do yourself and what do you need help with?
I will add basic
Validate
method implementation and extendgoType
. @KrishnaIyer will then take over and add actual validator tags and their implementation as needed