code: func newCodecFactory(scheme *runtime.Scheme, mf json.MetaFactory) CodecFactory {
  	jsonSerializer := json.NewSerializer(mf, scheme, runtime.ObjectTyperToTyper(scheme), false)
  	jsonPrettySerializer := json.NewSerializer(mf, scheme, runtime.ObjectTyperToTyper(scheme), true)
  	yamlSerializer := json.NewYAMLSerializer(mf, scheme, runtime.ObjectTyperToTyper(scheme))
  	serializers := []serializerType{
  		{
  			AcceptContentTypes: []string{"application/json"},
  			ContentType:        "application/json",
  			FileExtensions:     []string{"json"},
  			Serializer:         jsonSerializer,
  			PrettySerializer:   jsonPrettySerializer,
  		},
  		{
  			AcceptContentTypes: []string{"application/yaml"},
  			ContentType:        "application/yaml",
  			FileExtensions:     []string{"yaml"},
  			Serializer:         yamlSerializer,
  		},
  	}
  	decoders := make([]runtime.Decoder, 0, len(serializers))
  	accepts := []string{}
  	alreadyAccepted := make(map[string]struct{})
  	for _, d := range serializers {
  		decoders = append(decoders, d.Serializer)
  		for _, mediaType := range d.AcceptContentTypes {
  			if _, ok := alreadyAccepted[mediaType]; ok {
  				continue
  			}
  			alreadyAccepted[mediaType] = struct{}{}
  			accepts = append(accepts, mediaType)
  		}
  	}
  	return CodecFactory{
  		scheme:      scheme,
  		serializers: serializers,
  		universal:   recognizer.NewDecoder(decoders...),
  		accepts:     accepts,
  
  		legacySerializer: jsonSerializer,
  	}
  }
docs: // newCodecFactory is a helper for testing that allows a different metafactory to be specified.