Merge pull request #9962 from smarterclayton/type_patch

Give PATCH operations a better output in Swagger
This commit is contained in:
Satnam Singh 2015-06-18 14:31:49 -07:00
commit de457c3e49
4 changed files with 69 additions and 58 deletions

View File

@ -603,7 +603,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -631,7 +631,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.Endpoints"
}
],
"produces": [
@ -1264,7 +1264,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -1292,7 +1292,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.Event"
}
],
"produces": [
@ -1917,7 +1917,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -1945,7 +1945,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.LimitRange"
}
],
"produces": [
@ -2530,7 +2530,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -2550,7 +2550,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.Namespace"
}
],
"produces": [
@ -3058,7 +3058,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -3078,7 +3078,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.Node"
}
],
"produces": [
@ -3847,7 +3847,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -3875,7 +3875,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.PersistentVolumeClaim"
}
],
"produces": [
@ -4527,7 +4527,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -4547,7 +4547,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.PersistentVolume"
}
],
"produces": [
@ -5044,7 +5044,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -5072,7 +5072,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.Pod"
}
],
"produces": [
@ -6755,7 +6755,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -6783,7 +6783,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.PodTemplate"
}
],
"produces": [
@ -7416,7 +7416,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -7444,7 +7444,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.ReplicationController"
}
],
"produces": [
@ -8077,7 +8077,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -8105,7 +8105,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.ResourceQuota"
}
],
"produces": [
@ -8797,7 +8797,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -8825,7 +8825,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.Secret"
}
],
"produces": [
@ -9458,7 +9458,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -9486,7 +9486,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.ServiceAccount"
}
],
"produces": [
@ -10119,7 +10119,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -10147,7 +10147,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1.Service"
}
],
"produces": [
@ -11128,6 +11128,10 @@
}
}
},
"api.Patch": {
"id": "api.Patch",
"properties": {}
},
"v1.Status": {
"id": "v1.Status",
"properties": {

View File

@ -603,7 +603,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -631,7 +631,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.Endpoints"
}
],
"produces": [
@ -1264,7 +1264,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -1292,7 +1292,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.Event"
}
],
"produces": [
@ -1917,7 +1917,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -1945,7 +1945,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.LimitRange"
}
],
"produces": [
@ -2530,7 +2530,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -2550,7 +2550,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.Namespace"
}
],
"produces": [
@ -3058,7 +3058,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -3078,7 +3078,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.Node"
}
],
"produces": [
@ -3847,7 +3847,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -3875,7 +3875,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.PersistentVolumeClaim"
}
],
"produces": [
@ -4527,7 +4527,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -4547,7 +4547,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.PersistentVolume"
}
],
"produces": [
@ -5044,7 +5044,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -5072,7 +5072,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.Pod"
}
],
"produces": [
@ -6755,7 +6755,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -6783,7 +6783,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.PodTemplate"
}
],
"produces": [
@ -7416,7 +7416,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -7444,7 +7444,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.ReplicationController"
}
],
"produces": [
@ -8077,7 +8077,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -8105,7 +8105,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.ResourceQuota"
}
],
"produces": [
@ -8797,7 +8797,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -8825,7 +8825,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.Secret"
}
],
"produces": [
@ -9458,7 +9458,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -9486,7 +9486,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.ServiceAccount"
}
],
"produces": [
@ -10119,7 +10119,7 @@
"allowMultiple": false
},
{
"type": "string",
"type": "api.Patch",
"paramType": "body",
"name": "body",
"description": "",
@ -10147,7 +10147,7 @@
{
"code": 200,
"message": "OK",
"responseModel": "string"
"responseModel": "v1beta3.Service"
}
],
"produces": [
@ -11128,6 +11128,10 @@
}
}
},
"api.Patch": {
"id": "api.Patch",
"properties": {}
},
"v1beta3.Status": {
"id": "v1beta3.Status",
"properties": {

View File

@ -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{}

View File

@ -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)