Merge pull request #12507 from nikhiljindal/swaggerValid

Auto commit by PR queue bot
pull/6/head
k8s-merge-robot 2015-09-19 23:26:17 -07:00
commit cd37cd7c0a
2 changed files with 9 additions and 5 deletions

View File

@ -5909,7 +5909,7 @@
"allowMultiple": false
},
{
"type": "",
"type": "string",
"paramType": "query",
"name": "command",
"description": "Command is the remote command to execute. argv array. Not executed within a shell.",
@ -5987,7 +5987,7 @@
"allowMultiple": false
},
{
"type": "",
"type": "string",
"paramType": "query",
"name": "command",
"description": "Command is the remote command to execute. argv array. Not executed within a shell.",

View File

@ -807,7 +807,7 @@ func addObjectParams(ws *restful.WebService, route *restful.RouteBuilder, obj in
if docable, ok := obj.(documentable); ok {
desc = docable.SwaggerDoc()[jsonName]
}
route.Param(ws.QueryParameter(jsonName, desc).DataType(typeToJSON(sf.Type.Name())))
route.Param(ws.QueryParameter(jsonName, desc).DataType(typeToJSON(sf.Type.String())))
}
}
}
@ -822,12 +822,16 @@ func typeToJSON(typeName string) string {
return "boolean"
case "uint8", "int", "int32", "int64", "uint32", "uint64":
return "integer"
case "byte":
return "string"
case "float64", "float32":
return "number"
case "unversioned.Time":
return "string"
case "byte":
return "string"
case "[]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"
default:
return typeName
}