go-ozzo / ozzo-validation

An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.
MIT License
3.73k stars 224 forks source link

customization of GetErrorFieldName #182

Closed mikeleedev closed 1 year ago

mikeleedev commented 1 year ago

Adds an exported function GetErrorFieldName; which defaults to the existing getErrorFieldName function. This allows a package level override of how error field names are calculated when the default isn't desired.

The test illustrates overriding this function to get the error field name from a protobuf struct tag.