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

View File

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

View File

@ -64,3 +64,6 @@ func (apiVersions APIVersions) String() string {
func (apiVersions APIVersions) GoString() string { func (apiVersions APIVersions) GoString() string {
return apiVersions.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)). Consumes(string(api.JSONPatchType), string(api.MergePatchType), string(api.StrategicMergePatchType)).
Operation("patch"+kind+strings.Title(subresource)). Operation("patch"+kind+strings.Title(subresource)).
Produces(append(storageMeta.ProducesMIMETypes(action.Verb), "application/json")...). Produces(append(storageMeta.ProducesMIMETypes(action.Verb), "application/json")...).
Returns(http.StatusOK, "OK", "string"). Returns(http.StatusOK, "OK", versionedObject).
Reads("string"). Reads(api.Patch{}).
Writes(versionedObject) Writes(versionedObject)
addParams(route, action.Params) addParams(route, action.Params)
ws.Route(route) ws.Route(route)