From 61cef8f570e500184f3af978a28071a8a029f00b Mon Sep 17 00:00:00 2001 From: nikhiljindal Date: Tue, 3 Nov 2015 17:31:40 -0800 Subject: [PATCH] Updating typeToJSON to handle pointers as well --- pkg/apiserver/api_installer.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/apiserver/api_installer.go b/pkg/apiserver/api_installer.go index 4b874ac57e3..ffcf6968302 100644 --- a/pkg/apiserver/api_installer.go +++ b/pkg/apiserver/api_installer.go @@ -828,17 +828,17 @@ func addObjectParams(ws *restful.WebService, route *restful.RouteBuilder, obj in // Convert the name of a golang type to the name of a JSON type func typeToJSON(typeName string) string { switch typeName { - case "bool": + case "bool", "*bool": return "boolean" - case "uint8", "int", "int32", "int64", "uint32", "uint64": + case "uint8", "*uint8", "int", "*int", "int32", "*int32", "int64", "*int64", "uint32", "*uint32", "uint64", "*uint64": return "integer" - case "float64", "float32": + case "float64", "*float64", "float32", "*float32": return "number" - case "unversioned.Time": + case "unversioned.Time", "*unversioned.Time": return "string" - case "byte": + case "byte", "*byte": return "string" - case "[]string": + case "[]string", "[]*string": // TODO: Fix this when go-restful supports a way to specify an array query param: // https://github.com/emicklei/go-restful/issues/225 return "string"