Fixing swagger spec

This commit is contained in:
nikhiljindal 2015-08-10 18:32:37 -07:00
parent e7d4426158
commit 4ee799e181
2 changed files with 9 additions and 5 deletions

View File

@ -5909,7 +5909,7 @@
"allowMultiple": false "allowMultiple": false
}, },
{ {
"type": "", "type": "string",
"paramType": "query", "paramType": "query",
"name": "command", "name": "command",
"description": "Command is the remote command to execute. argv array. Not executed within a shell.", "description": "Command is the remote command to execute. argv array. Not executed within a shell.",
@ -5987,7 +5987,7 @@
"allowMultiple": false "allowMultiple": false
}, },
{ {
"type": "", "type": "string",
"paramType": "query", "paramType": "query",
"name": "command", "name": "command",
"description": "Command is the remote command to execute. argv array. Not executed within a shell.", "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 { if docable, ok := obj.(documentable); ok {
desc = docable.SwaggerDoc()[jsonName] 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" return "boolean"
case "uint8", "int", "int32", "int64", "uint32", "uint64": case "uint8", "int", "int32", "int64", "uint32", "uint64":
return "integer" return "integer"
case "byte":
return "string"
case "float64", "float32": case "float64", "float32":
return "number" return "number"
case "unversioned.Time": case "unversioned.Time":
return "string" 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: default:
return typeName return typeName
} }