func (c *GlobalHookConfig) LoadAndValidate(data []byte) error {
	vu := config.NewDefaultVersionedUntyped()
	err := vu.Load(data)
	if err != nil {
		return err
	}
	err = config.ValidateConfig(vu.Obj, GetGlobalHookConfigSchema(vu.Version), "")
	if err != nil {
		return err
	}
	c.Version = vu.Version
	err = c.HookConfig.ConvertAndCheck(data)
	if err != nil {
		return err
	}
	err = c.ConvertAndCheck(data)
	if err != nil {
		return err
	}
	return nil
}
LoadAndValidate loads config from bytes and validate it. Returns multierror.
package module_manager
import (
	"errors"
	"fmt"
	"github.com/davecgh/go-spew/spew"
	types2 "github.com/flant/shell-operator/pkg/kube_events_manager/types"
	"github.com/go-openapi/spec"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"sigs.k8s.io/yaml"
	. "github.com/flant/addon-operator/pkg/hook/types"
	"github.com/flant/addon-operator/pkg/module_manager/go_hook"
	. "github.com/flant/shell-operator/pkg/hook/types"
	"github.com/flant/shell-operator/pkg/hook/config"
	"github.com/flant/shell-operator/pkg/kube_events_manager"
	"github.com/flant/shell-operator/pkg/schedule_manager/types"
)
const (
	defaultHookGroupName = "main"
	defaultHookQueueName = "main"
)
type GlobalHookConfig struct {
	config.HookConfig
	GlobalV0 *GlobalHookConfigV0
	GlobalV1 *GlobalHookConfigV0
	BeforeAll *BeforeAllConfig
	AfterAll  *AfterAllConfig
}
type BeforeAllConfig struct {
	CommonBindingConfig
	Order float64
}
type AfterAllConfig struct {
	CommonBindingConfig
	Order float64
}
type GlobalHookConfigV0 struct {
	BeforeAll interface{} `json:"beforeAll"`
	AfterAll  interface{} `json:"afterAll"`
}
func GetGlobalHookConfigSchema(version string) *spec.Schema {
	globalHookVersion := "global-hook-" + version
	if _, ok := config.Schemas[globalHookVersion]; !ok {
		schema := config.Schemas[version]
		switch version {
		case "v1":
			schema += `
  beforeAll:
    type: integer
    example: 10    
  afterAll:
    type: integer
    example: 10    
`
		case "v0":
			schema += `
  beforeAll:
    type: integer
    example: 10    
  afterAll:
    type: integer
    example: 10    
`
		}
		config.Schemas[globalHookVersion] = schema
	}
	return config.GetSchema(globalHookVersion)
}