We've been moving along with more functionality in the Golang proxy, mostly
the Read's up until now, comparatively TO does much fewer Create/Updates.
Our current task is to circle back and start implementing the (C)reate,
(U)pdate, and (D)eletes.  One of the obvious needs for the this task are
validation rules.  I've been doing research to figure out the cleanest and
most maintainable way to rewrite the Perl validation rules in Go.

TC Issue for tracking
https://github.com/apache/incubator-trafficcontrol/issues/1756

These are the two dependencies I'd like to leverage and provide feedback:

Both are MIT Licenses
Uses normal programming constructs rather than error-prone struct tags to
specify how data should be validated.
https://github.com/go-ozzo/ozzo-validation
https://github.com/go-ozzo/ozzo-validation/blob/master/LICENSE

Core Validation library that the prior library uses that has a lot of
useful convenience methods that I'd rather not re-invent
https://github.com/asaskevich/govalidator
https://github.com/asaskevich/govalidator#list-of-functions
https://github.com/asaskevich/govalidator/blob/master/LICENSE

And here is how I've used these as sample validation rules that I've
implemented as a POC:

https://github.com/dewrich/incubator-trafficcontrol/blob/tor-api-ds/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go#L93

Existing Mojo Perl Rules for comparison.
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/API/Deliveryservice.pm#L1363


-Dew

Reply via email to