code: func asVersionedObjects(infos []*resource.Info, specifiedOutputVersion schema.GroupVersion, encoder runtime.Encoder) ([]runtime.Object, error) {
  	objects := []runtime.Object{}
  	for _, info := range infos {
  		if info.Object == nil {
  			continue
  		}
  
  		targetVersions := []schema.GroupVersion{}
  		// objects that are not part of api.Scheme must be converted to JSON
  		// TODO: convert to map[string]interface{}, attach to runtime.Unknown?
  		if !specifiedOutputVersion.Empty() {
  			if _, _, err := scheme.Scheme.ObjectKinds(info.Object); runtime.IsNotRegisteredError(err) {
  				// TODO: ideally this would encode to version, but we don't expose multiple codecs here.
  				data, err := runtime.Encode(encoder, info.Object)
  				if err != nil {
  					return nil, err
  				}
  				// TODO: Set ContentEncoding and ContentType.
  				objects = append(objects, &runtime.Unknown{Raw: data})
  				continue
  			}
  			targetVersions = append(targetVersions, specifiedOutputVersion)
  		} else {
  			gvks, _, err := scheme.Scheme.ObjectKinds(info.Object)
  			if err == nil {
  				for _, gvk := range gvks {
  					targetVersions = append(targetVersions, scheme.Scheme.PrioritizedVersionsForGroup(gvk.Group)...)
  				}
  			}
  		}
  
  		converted, err := tryConvert(scheme.Scheme, info.Object, targetVersions...)
  		if err != nil {
  			return nil, err
  		}
  		objects = append(objects, converted)
  	}
  	return objects, nil
  }
docs: // asVersionedObjects converts a list of infos into versioned objects. The provided
  // version will be preferred as the conversion target, but the Object's mapping version will be
  // used if that version is not present.