mwitkow / go-proto-validators

Generate message validators from .proto annotations.
Apache License 2.0
1.09k stars 164 forks source link

Validation for enum values #46

Closed florinutz closed 5 years ago

florinutz commented 6 years ago

This adds the is_in_enum validation option for enums, which checks if incoming values are actually defined in the enum. The previous way of doing this was hackish, as one had to use gt and lt in order to check for the range (instead of actual enum values), and the lt would have to be kept updated as more fields are added to the enum.

fho commented 5 years ago

@mwitkow is there any chance to get the PR merged to upstream?

mwitkow commented 5 years ago

Makes sense :) thanks!