Fix Operation names for subresources

pull/6/head
mbohlool 2017-07-20 22:50:58 -07:00
parent d368afd845
commit 61ba8ca0bc
2 changed files with 8 additions and 4 deletions

View File

@ -577,6 +577,14 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
routes := []*restful.RouteBuilder{}
// If there is a subresource, kind should be the parent's kind.
if hasSubresource {
fqParentKind, err := a.getResourceKind(resource, a.group.Storage[resource])
if err != nil {
return nil, err
}
kind = fqParentKind.Kind
}
switch action.Verb {
case "GET": // Get a resource.
var handler restful.RouteFunction

View File

@ -63,10 +63,6 @@ func GetOperationIDAndTags(r *restful.Route) (string, []string, error) {
op := r.Operation
path := r.Path
var tags []string
// TODO: This is hacky, figure out where this name conflict is created and fix it at the root.
if strings.HasPrefix(path, "/apis/extensions/v1beta1/namespaces/{namespace}/") && strings.HasSuffix(op, "ScaleScale") {
op = op[:len(op)-10] + strings.Title(strings.Split(path[48:], "/")[0]) + "Scale"
}
prefix, exists := verbs.GetPrefix(op)
if !exists {
return op, tags, fmt.Errorf("operation names should start with a verb. Cannot determine operation verb from %v", op)