utils/openapi.go
func NewOpenAPISchemaFor(delegate discovery.OpenAPISchemaInterface, gvk schema.GroupVersionKind) (*OpenAPISchema, error) {
	log.Debugf("Fetching schema for %v", gvk)
	doc, err := delegate.OpenAPISchema()
	if err != nil {
		return nil, err
	}
	res, err := openapi.NewOpenAPIData(doc)
	if err != nil {
		return nil, err
	}

	sc := res.LookupResource(gvk)
	if sc == nil {
		gvr := schema.GroupResource{
			// TODO(mkm): figure out a meaningful group+resource for schemas.
			Group:    "schema",
			Resource: "schema",
		}
		return nil, errors.NewNotFound(gvr, fmt.Sprintf("%s", gvk))
	}
	return &OpenAPISchema{schema: sc}, nil
}
func NewOpenAPISchemaFor(delegate discovery.OpenAPISchemaInterface, gvk schema.GroupVersionKind) (*OpenAPISchema, error) {
	log.Debugf("Fetching schema for %v", gvk)
	doc, err := delegate.OpenAPISchema()
	if err != nil {
		return nil, err
	}
	res, err := openapi.NewOpenAPIData(doc)
	if err != nil {
		return nil, err
	}

	sc := res.LookupResource(gvk)
	if sc == nil {
		gvr := schema.GroupResource{
			// TODO(mkm): figure out a meaningful group+resource for schemas.
			Group:    "schema",
			Resource: "schema",
		}
		return nil, errors.NewNotFound(gvr, fmt.Sprintf("%s", gvk))
	}
	return &OpenAPISchema{schema: sc}, nil
}
// NewOpenAPISchemaFor returns the OpenAPISchema object ready to validate objects of given GroupVersion