Add a streaming and "raw" abstraction to codec factory

This commit is contained in:
Clayton Coleman
2016-03-21 12:40:41 -04:00
parent 2bb6f74bf9
commit 54eaa56b92
10 changed files with 299 additions and 87 deletions

View File

@@ -39,9 +39,15 @@ var Versions = []string{"v1"}
// Codec is the default codec for serializing input that should use
// the latest supported version. It supports JSON by default.
var Codec = versioning.NewCodecForScheme(
api.Scheme,
json.NewSerializer(json.DefaultMetaFactory, api.Scheme, runtime.ObjectTyperToTyper(api.Scheme), true),
[]unversioned.GroupVersion{{Version: Version}},
[]unversioned.GroupVersion{{Version: runtime.APIVersionInternal}},
)
var Codec runtime.Codec
func init() {
jsonSerializer := json.NewSerializer(json.DefaultMetaFactory, api.Scheme, runtime.ObjectTyperToTyper(api.Scheme), true)
Codec = versioning.NewCodecForScheme(
api.Scheme,
jsonSerializer,
jsonSerializer,
[]unversioned.GroupVersion{{Version: Version}},
[]unversioned.GroupVersion{{Version: runtime.APIVersionInternal}},
)
}