From 93f921b677f23e7bda559d3262724347b5b62314 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 17 Jun 2015 15:21:54 -0400 Subject: [PATCH] Swagger output for PATCH can be more strongly typed --- pkg/api/unversioned.go | 3 +++ pkg/apiserver/api_installer.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/api/unversioned.go b/pkg/api/unversioned.go index 9a531326851..86c9bcd07ec 100644 --- a/pkg/api/unversioned.go +++ b/pkg/api/unversioned.go @@ -64,3 +64,6 @@ func (apiVersions APIVersions) String() string { func (apiVersions APIVersions) GoString() string { return apiVersions.String() } + +// Patch is provided to give a concrete name and type to the Kubernetes PATCH request body. +type Patch struct{} diff --git a/pkg/apiserver/api_installer.go b/pkg/apiserver/api_installer.go index 261b34da6da..f4d5aae1a5e 100644 --- a/pkg/apiserver/api_installer.go +++ b/pkg/apiserver/api_installer.go @@ -447,8 +447,8 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag Consumes(string(api.JSONPatchType), string(api.MergePatchType), string(api.StrategicMergePatchType)). Operation("patch"+kind+strings.Title(subresource)). Produces(append(storageMeta.ProducesMIMETypes(action.Verb), "application/json")...). - Returns(http.StatusOK, "OK", "string"). - Reads("string"). + Returns(http.StatusOK, "OK", versionedObject). + Reads(api.Patch{}). Writes(versionedObject) addParams(route, action.Params) ws.Route(route)