From 7cc7452ee9277e767aac06df0f2190c833a81735 Mon Sep 17 00:00:00 2001 From: Matt Rickard Date: Wed, 4 Oct 2017 08:59:08 -0700 Subject: [PATCH] Add patch for openapi --- hack/godeps/godep-save.sh | 1 + hack/openapi.diff | 31 +++++++++++++++++++ .../pkg/endpoints/openapi/openapi.go | 9 ++++-- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 hack/openapi.diff diff --git a/hack/godeps/godep-save.sh b/hack/godeps/godep-save.sh index 2a873ff554c5..ed9692d05e2f 100755 --- a/hack/godeps/godep-save.sh +++ b/hack/godeps/godep-save.sh @@ -37,5 +37,6 @@ git checkout -- ${MINIKUBE_ROOT}/vendor/golang.org/x/sys/windows pushd ${MINIKUBE_ROOT} >/dev/null git apply ${MINIKUBE_ROOT}/hack/tpr-patch.diff git apply ${MINIKUBE_ROOT}/hack/kube-proxy-patch.diff + git apply ${MINIKUBE_ROOT}/hack/openapi.diff popd >/dev/null diff --git a/hack/openapi.diff b/hack/openapi.diff new file mode 100644 index 000000000000..a02b43f66248 --- /dev/null +++ b/hack/openapi.diff @@ -0,0 +1,31 @@ +diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go b/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go +index 182c51796..03725947c 100644 +--- a/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go ++++ b/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go +@@ -26,11 +26,12 @@ import ( + "github.com/emicklei/go-restful" + "github.com/go-openapi/spec" + ++ "sort" ++ + "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/util/trie" +- "sort" + ) + + var verbs = trie.New([]string{"get", "log", "read", "replace", "patch", "delete", "deletecollection", "watch", "connect", "proxy", "list", "create", "patch"}) +@@ -135,7 +136,11 @@ func friendlyName(name string) string { + } + + func typeName(t reflect.Type) string { +- return fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()) ++ path := t.PkgPath() ++ if strings.Contains(path, "/vendor/") { ++ path = path[strings.Index(path, "/vendor/")+len("/vendor/"):] ++ } ++ return fmt.Sprintf("%s.%s", path, t.Name()) + } + + // NewDefinitionNamer constructs a new DefinitionNamer to be used to customize OpenAPI spec. diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go b/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go index 182c51796d82..03725947c9ca 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/openapi/openapi.go @@ -26,11 +26,12 @@ import ( "github.com/emicklei/go-restful" "github.com/go-openapi/spec" + "sort" + "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/util/trie" - "sort" ) var verbs = trie.New([]string{"get", "log", "read", "replace", "patch", "delete", "deletecollection", "watch", "connect", "proxy", "list", "create", "patch"}) @@ -135,7 +136,11 @@ func friendlyName(name string) string { } func typeName(t reflect.Type) string { - return fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()) + path := t.PkgPath() + if strings.Contains(path, "/vendor/") { + path = path[strings.Index(path, "/vendor/")+len("/vendor/"):] + } + return fmt.Sprintf("%s.%s", path, t.Name()) } // NewDefinitionNamer constructs a new DefinitionNamer to be used to customize OpenAPI spec.