|
|
|
@ -12,12 +12,14 @@ import ( |
|
|
|
|
func (y *Y) MarshalJSON() ([]byte, error) { |
|
|
|
|
type YJSON0 struct { |
|
|
|
|
Foo *json0.Foo `optional:"true"` |
|
|
|
|
Foo2 *json0.Foo `optional:"true"` |
|
|
|
|
Bar *errors0.Foo `optional:"true"` |
|
|
|
|
Gazonk *YJSON `optional:"true"` |
|
|
|
|
Over *enc `optional:"true"` |
|
|
|
|
} |
|
|
|
|
var enc0 YJSON0 |
|
|
|
|
enc0.Foo = &y.Foo |
|
|
|
|
enc0.Foo2 = &y.Foo2 |
|
|
|
|
enc0.Bar = &y.Bar |
|
|
|
|
enc0.Gazonk = &y.Gazonk |
|
|
|
|
enc0.Over = (*enc)(&y.Over) |
|
|
|
@ -27,6 +29,7 @@ func (y *Y) MarshalJSON() ([]byte, error) { |
|
|
|
|
func (y *Y) UnmarshalJSON(input []byte) error { |
|
|
|
|
type YJSON0 struct { |
|
|
|
|
Foo *json0.Foo `optional:"true"` |
|
|
|
|
Foo2 *json0.Foo `optional:"true"` |
|
|
|
|
Bar *errors0.Foo `optional:"true"` |
|
|
|
|
Gazonk *YJSON `optional:"true"` |
|
|
|
|
Over *enc `optional:"true"` |
|
|
|
@ -39,6 +42,9 @@ func (y *Y) UnmarshalJSON(input []byte) error { |
|
|
|
|
if dec.Foo != nil { |
|
|
|
|
x.Foo = *dec.Foo |
|
|
|
|
} |
|
|
|
|
if dec.Foo2 != nil { |
|
|
|
|
x.Foo2 = *dec.Foo2 |
|
|
|
|
} |
|
|
|
|
if dec.Bar != nil { |
|
|
|
|
x.Bar = *dec.Bar |
|
|
|
|
} |
|
|
|
@ -55,12 +61,14 @@ func (y *Y) UnmarshalJSON(input []byte) error { |
|
|
|
|
func (y *Y) MarshalYAML() (interface{}, error) { |
|
|
|
|
type YYAML struct { |
|
|
|
|
Foo *json0.Foo `optional:"true"` |
|
|
|
|
Foo2 *json0.Foo `optional:"true"` |
|
|
|
|
Bar *errors0.Foo `optional:"true"` |
|
|
|
|
Gazonk *YJSON `optional:"true"` |
|
|
|
|
Over *enc `optional:"true"` |
|
|
|
|
} |
|
|
|
|
var enc0 YYAML |
|
|
|
|
enc0.Foo = &y.Foo |
|
|
|
|
enc0.Foo2 = &y.Foo2 |
|
|
|
|
enc0.Bar = &y.Bar |
|
|
|
|
enc0.Gazonk = &y.Gazonk |
|
|
|
|
enc0.Over = (*enc)(&y.Over) |
|
|
|
@ -70,6 +78,7 @@ func (y *Y) MarshalYAML() (interface{}, error) { |
|
|
|
|
func (y *Y) UnmarshalYAML(unmarshal func(interface{}) error) error { |
|
|
|
|
type YYAML struct { |
|
|
|
|
Foo *json0.Foo `optional:"true"` |
|
|
|
|
Foo2 *json0.Foo `optional:"true"` |
|
|
|
|
Bar *errors0.Foo `optional:"true"` |
|
|
|
|
Gazonk *YJSON `optional:"true"` |
|
|
|
|
Over *enc `optional:"true"` |
|
|
|
@ -82,6 +91,9 @@ func (y *Y) UnmarshalYAML(unmarshal func(interface{}) error) error { |
|
|
|
|
if dec.Foo != nil { |
|
|
|
|
x.Foo = *dec.Foo |
|
|
|
|
} |
|
|
|
|
if dec.Foo2 != nil { |
|
|
|
|
x.Foo2 = *dec.Foo2 |
|
|
|
|
} |
|
|
|
|
if dec.Bar != nil { |
|
|
|
|
x.Bar = *dec.Bar |
|
|
|
|
} |
|
|
|
|