dewrich commented on a change in pull request #1940: TO golang -- adds 
validation rules for ASNs, CDNs APIs
URL: 
https://github.com/apache/incubator-trafficcontrol/pull/1940#discussion_r171348669
 
 

 ##########
 File path: traffic_ops/traffic_ops_golang/asn/asns.go
 ##########
 @@ -47,26 +47,29 @@ func GetRefType() *TOASN {
 }
 
 //Implementation of the Identifier, Validator interface functions
-func (asn *TOASN) GetID() (int, bool) {
+func (asn TOASN) GetID() (int, bool) {
        return asn.ID, true
 }
 
-func (asn *TOASN) GetAuditName() string {
+func (asn TOASN) GetAuditName() string {
        return strconv.Itoa(asn.ASN)
 }
 
-func (asn *TOASN) GetType() string {
+func (asn TOASN) GetType() string {
        return "asn"
 }
 
 func (asn *TOASN) SetID(i int) {
        asn.ID = i
 }
 
-func (asn *TOASN) Validate(db *sqlx.DB) []error {
+func (asn TOASN) Validate(db *sqlx.DB) []error {
        errs := []error{}
-       if asn.ASN < 1 {
-               errs = append(errs, errors.New(`ASN 'asn' is required.`))
+       if asn.ASN < 0 {
 
 Review comment:
   Should this be the Validation framework doing the checks for consistency?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to