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

package test

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

type DateTime struct {
	// MyObject corresponds to the JSON schema field "myObject".
	MyObject *DateTimeMyObject `json:"myObject,omitempty,omitzero" yaml:"myObject,omitempty" mapstructure:"myObject,omitempty"`
}

type DateTimeMyObject struct {
	// MyDateTime corresponds to the JSON schema field "myDateTime".
	MyDateTime time.Time `json:"myDateTime" yaml:"myDateTime" mapstructure:"myDateTime"`
}

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

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