forked from loafle/openapi-generator-original
reset to nil, replace tab wtih space (#6352)
This commit is contained in:
parent
f8a144bdc1
commit
d92b8833b0
@ -40,6 +40,11 @@ func (dst *{{classname}}) UnmarshalJSON(data []byte) error {
|
||||
|
||||
{{/oneOf}}
|
||||
if match > 1 { // more than 1 match
|
||||
// reset to nil
|
||||
{{#oneOf}}
|
||||
dst.{{{.}}} = nil
|
||||
{{/oneOf}}
|
||||
|
||||
return fmt.Errorf("Data matches more than one schema in oneOf({{classname}})")
|
||||
} else if match == 1 {
|
||||
return nil // exactly one match
|
||||
|
@ -62,6 +62,10 @@ func (dst *Fruit) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
if match > 1 { // more than 1 match
|
||||
// reset to nil
|
||||
dst.Apple = nil
|
||||
dst.Banana = nil
|
||||
|
||||
return fmt.Errorf("Data matches more than one schema in oneOf(Fruit)")
|
||||
} else if match == 1 {
|
||||
return nil // exactly one match
|
||||
|
@ -62,6 +62,10 @@ func (dst *FruitReq) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
if match > 1 { // more than 1 match
|
||||
// reset to nil
|
||||
dst.AppleReq = nil
|
||||
dst.BananaReq = nil
|
||||
|
||||
return fmt.Errorf("Data matches more than one schema in oneOf(FruitReq)")
|
||||
} else if match == 1 {
|
||||
return nil // exactly one match
|
||||
|
@ -62,6 +62,10 @@ func (dst *Mammal) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
if match > 1 { // more than 1 match
|
||||
// reset to nil
|
||||
dst.Whale = nil
|
||||
dst.Zebra = nil
|
||||
|
||||
return fmt.Errorf("Data matches more than one schema in oneOf(Mammal)")
|
||||
} else if match == 1 {
|
||||
return nil // exactly one match
|
||||
|
Loading…
x
Reference in New Issue
Block a user