rawlinp opened a new issue #2560: TO Go cachegroups, DS regexes, servers, and 
staticdnsentries don't validate their type
URL: https://github.com/apache/trafficcontrol/issues/2560
 
 
   These TO Go endpoints do not validate that the requested `type` is actually 
a usable type for that endpoint. Right now you can create a cachegroup of type 
`A_RECORD`, a server of type `HOST_REGEXP`, and so on.
   
   Since there are several different entities that use the `type` table, I'd 
propose handling this in the shared handlers alongside the call to 
`foo.Validate()`. We can create an interface like the following that the 
affected structs can implement:
   ```
   type RequiredTyper interface {
       RequiredType() string
   }
   ```
   with implementations that just return the string value of the `use_in_table` 
they expect of their type. If the type is missing, not found, or incorrect, the 
shared handler would return a `400 Bad Request`.
   
   Entities that don't use the shared handlers could import the same code that 
the shared handler would use to do the validation.

----------------------------------------------------------------
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