update decoder to use GroupVersion

This commit is contained in:
deads2k
2015-11-17 10:07:45 -05:00
parent 3bd23b185b
commit 6231404682
12 changed files with 78 additions and 47 deletions

View File

@@ -343,7 +343,8 @@ func createHandler(r rest.NamedCreater, scope RequestScope, typer runtime.Object
}
obj := r.New()
if err := scope.Codec.DecodeIntoWithSpecifiedVersionKind(body, obj, scope.APIVersion, scope.Kind); err != nil {
// TODO this cleans up with proper typing
if err := scope.Codec.DecodeIntoWithSpecifiedVersionKind(body, obj, unversioned.ParseGroupVersionOrDie(scope.APIVersion).WithKind(scope.Kind)); err != nil {
err = transformDecodeError(typer, err, obj, body)
errorJSON(err, scope.Codec, w)
return
@@ -576,7 +577,7 @@ func UpdateResource(r rest.Updater, scope RequestScope, typer runtime.ObjectType
}
obj := r.New()
if err := scope.Codec.DecodeIntoWithSpecifiedVersionKind(body, obj, scope.APIVersion, scope.Kind); err != nil {
if err := scope.Codec.DecodeIntoWithSpecifiedVersionKind(body, obj, unversioned.ParseGroupVersionOrDie(scope.APIVersion).WithKind(scope.Kind)); err != nil {
err = transformDecodeError(typer, err, obj, body)
errorJSON(err, scope.Codec, w)
return