forked from loafle/openapi-generator-original
[go-experimental] Fix error message when unmarshaling wrong enum value (#6663)
* Use actual value in error message * Generate samples
This commit is contained in:
parent
55d8e759de
commit
2460cfccfa
@ -26,7 +26,7 @@ func (v *{{{classname}}}) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid {{classname}}", *v)
|
||||
return fmt.Errorf("%+v is not a valid {{classname}}", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to {{{name}}} value
|
||||
|
@ -38,7 +38,7 @@ func (v *EnumClass) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid EnumClass", *v)
|
||||
return fmt.Errorf("%+v is not a valid EnumClass", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to EnumClass value
|
||||
|
@ -38,7 +38,7 @@ func (v *OuterEnum) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid OuterEnum", *v)
|
||||
return fmt.Errorf("%+v is not a valid OuterEnum", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to OuterEnum value
|
||||
|
@ -38,7 +38,7 @@ func (v *EnumClass) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid EnumClass", *v)
|
||||
return fmt.Errorf("%+v is not a valid EnumClass", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to EnumClass value
|
||||
|
@ -38,7 +38,7 @@ func (v *OuterEnum) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid OuterEnum", *v)
|
||||
return fmt.Errorf("%+v is not a valid OuterEnum", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to OuterEnum value
|
||||
|
@ -38,7 +38,7 @@ func (v *OuterEnumDefaultValue) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid OuterEnumDefaultValue", *v)
|
||||
return fmt.Errorf("%+v is not a valid OuterEnumDefaultValue", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to OuterEnumDefaultValue value
|
||||
|
@ -38,7 +38,7 @@ func (v *OuterEnumInteger) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid OuterEnumInteger", *v)
|
||||
return fmt.Errorf("%+v is not a valid OuterEnumInteger", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to OuterEnumInteger value
|
||||
|
@ -38,7 +38,7 @@ func (v *OuterEnumIntegerDefaultValue) UnmarshalJSON(src []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid OuterEnumIntegerDefaultValue", *v)
|
||||
return fmt.Errorf("%+v is not a valid OuterEnumIntegerDefaultValue", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to OuterEnumIntegerDefaultValue value
|
||||
|
Loading…
x
Reference in New Issue
Block a user