func (s *Scheme) Decode(data []byte) (interface{}, error) {
	version, kind, err := s.DataVersionAndKind(data)
	if err != nil {
		return nil, err
	}
	if version == "" && s.InternalVersion != "" {
		return nil, fmt.Errorf("version not set in '%s'", string(data))
	}
	if kind == "" {
		return nil, fmt.Errorf("kind not set in '%s'", string(data))
	}
	obj, err := s.NewObject(version, kind)
	if err != nil {
		return nil, err
	}
	err = yaml.Unmarshal(data, obj)
	if err != nil {
		return nil, err
	}
	err = s.SetVersionAndKind("", "", obj)
	if err != nil {
		return nil, err
	}
	if s.InternalVersion != version {
		objOut, err := s.NewObject(s.InternalVersion, kind)
		if err != nil {
			return nil, err
		}
		err = s.converter.Convert(obj, objOut, 0, s.generateConvertMeta(version, s.InternalVersion))
		if err != nil {
			return nil, err
		}
		obj = objOut
	}
	return obj, nil
}
Decode converts a YAML or JSON string back into a pointer to an api object.
Deduces the type based upon the fields added by the MetaInsertionFactory
technique. The object will be converted, if necessary, into the
s.InternalVersion type before being returned. Decode will not decode
objects without version set unless InternalVersion is also "".
package conversion
import (
	"errors"
	"fmt"
	"github.com/ghodss/yaml"
)