// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.

package test

import "encoding/json"
import "fmt"
import yaml "gopkg.in/yaml.v3"

type AllOf1 struct {
	// Configurations corresponds to the JSON schema field "configurations".
	Configurations []AllOf1ConfigurationsElem `json:"configurations,omitempty,omitzero" yaml:"configurations,omitempty" mapstructure:"configurations,omitempty"`
}

type AllOf1ConfigurationsElem struct {
	// Bar corresponds to the JSON schema field "bar".
	Bar float64 `json:"bar" yaml:"bar" mapstructure:"bar"`

	// Foo corresponds to the JSON schema field "foo".
	Foo string `json:"foo" yaml:"foo" mapstructure:"foo"`
}

// UnmarshalJSON implements json.Unmarshaler.
func (j *AllOf1ConfigurationsElem) UnmarshalJSON(value []byte) error {
	var raw map[string]interface{}
	if err := json.Unmarshal(value, &raw); err != nil {
		return err
	}
	if _, ok := raw["bar"]; raw != nil && !ok {
		return fmt.Errorf("field bar in AllOf1ConfigurationsElem: required")
	}
	if _, ok := raw["foo"]; raw != nil && !ok {
		return fmt.Errorf("field foo in AllOf1ConfigurationsElem: required")
	}
	type Plain AllOf1ConfigurationsElem
	var plain Plain
	if err := json.Unmarshal(value, &plain); err != nil {
		return err
	}
	*j = AllOf1ConfigurationsElem(plain)
	return nil
}

// UnmarshalYAML implements yaml.Unmarshaler.
func (j *AllOf1ConfigurationsElem) UnmarshalYAML(value *yaml.Node) error {
	var raw map[string]interface{}
	if err := value.Decode(&raw); err != nil {
		return err
	}
	if _, ok := raw["bar"]; raw != nil && !ok {
		return fmt.Errorf("field bar in AllOf1ConfigurationsElem: required")
	}
	if _, ok := raw["foo"]; raw != nil && !ok {
		return fmt.Errorf("field foo in AllOf1ConfigurationsElem: required")
	}
	type Plain AllOf1ConfigurationsElem
	var plain Plain
	if err := value.Decode(&plain); err != nil {
		return err
	}
	*j = AllOf1ConfigurationsElem(plain)
	return nil
}
