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

@@ -141,11 +141,13 @@ func (gv GroupVersion) String() string {
}
// special case of "v1" for backward compatibility
if gv.Group == "" && gv.Version == "v1" {
if len(gv.Group) == 0 && gv.Version == "v1" {
return gv.Version
} else {
}
if len(gv.Group) > 0 {
return gv.Group + "/" + gv.Version
}
return gv.Version
}
// ParseGroupVersion turns "group/version" string into a GroupVersion struct. It reports error
@@ -163,6 +165,8 @@ func ParseGroupVersion(gv string) (GroupVersion, error) {
switch {
case len(s) == 1 && gv == "v1":
return GroupVersion{"", "v1"}, nil
case len(s) == 1:
return GroupVersion{"", s[0]}, nil
case len(s) == 2:
return GroupVersion{s[0], s[1]}, nil
default: