Switch API objects to not register per version codecs

Remove Codec from versionInterfaces in meta (RESTMapper is now agnostic
to codec and serialization). Register api/latest.Codecs as the codec
factory and use latest.Codecs.LegacyCodec(version) as an equvialent to
the previous codec.
This commit is contained in:
Clayton Coleman
2015-12-21 00:21:26 -05:00
parent 125ef6fbc8
commit c1d932e44a
54 changed files with 258 additions and 239 deletions

View File

@@ -73,7 +73,7 @@ func TestAPIObjectMeta(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if e, a := "/a", typeAccessor.GetAPIVersion(); e != a {
if e, a := "a", typeAccessor.GetAPIVersion(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "b", typeAccessor.GetKind(); e != a {
@@ -102,7 +102,7 @@ func TestAPIObjectMeta(t *testing.T) {
if e, a := types.UID("other"), j.UID; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "/c", j.APIVersion; e != a {
if e, a := "c", j.APIVersion; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "d", j.Kind; e != a {
@@ -117,7 +117,7 @@ func TestAPIObjectMeta(t *testing.T) {
typeAccessor.SetAPIVersion("d")
typeAccessor.SetKind("e")
if e, a := "/d", j.APIVersion; e != a {
if e, a := "d", j.APIVersion; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "e", j.Kind; e != a {
@@ -308,7 +308,7 @@ func TestGenericTypeMetaAccessor(t *testing.T) {
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if e, a := "/a", apiVersion; e != a {
if e, a := "a", apiVersion; e != a {
t.Errorf("expected %v, got %v", e, a)
}
kind, err := accessor.Kind(j)
@@ -392,7 +392,7 @@ func TestGenericTypeMetaAccessor(t *testing.T) {
if e, a := "other", j.TypeMeta.UID; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "/c", j.TypeMeta.APIVersion; e != a {
if e, a := "c", j.TypeMeta.APIVersion; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "d", j.TypeMeta.Kind; e != a {
@@ -757,7 +757,7 @@ func BenchmarkAccessorSetReflection(b *testing.B) {
Name: "foo",
GenerateName: "prefix",
UID: "uid",
APIVersion: "/a",
APIVersion: "a",
Kind: "b",
ResourceVersion: "1",
SelfLink: "some/place/only/we/know",