You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var val json.RawMessage // (unused variable error)
return nil
}`
UnmashalJSON method is causing an issue for checking of all the attribute(struct) throwing error, if not provided value for it, all the attribute become mandatory.
Example : `func (r *GfastPortReason) UnmarshalJSON(data []byte) error {
var fields map[string]json.RawMessage
if err := json.Unmarshal(data, &fields); err != nil {
return err
}
var val json.RawMessage
val = func() json.RawMessage {
if v, ok := fields["reason"]; ok {
return v
}
return nil
}()
if val != nil {
if err := json.Unmarshal([]byte(val), &r.Reason); err != nil {
return err
}
} else {
return fmt.Errorf("no value specified for reason")
}
val = func() json.RawMessage {
if v, ok := fields["description"]; ok {
return v
}
return nil
}()
if val != nil {
if err := json.Unmarshal([]byte(val), &r.Description); err != nil {
return err
}
} else {
return fmt.Errorf("no value specified for description")
}
return nil
}`
The text was updated successfully, but these errors were encountered:
We upgraded from version v7.3.1 to v10.2.1 facing following issues
When fields is empty slice(array) Code generation causing an compilation issue.
{
"type": "record",
"name": "EquipmentDiscoveryStarted",
"namespace": "io.leitstand.actor.events.controllers",
"fields": []
}
`func (r EquipmentDiscoveryStarted) MarshalJSON() ([]byte, error) {
var err error // (unused variable error)
output := make(map[string]json.RawMessage)
return json.Marshal(output)
}
func (r *EquipmentDiscoveryStarted) UnmarshalJSON(data []byte) error {
var fields map[string]json.RawMessage
if err := json.Unmarshal(data, &fields); err != nil {
return err
}
var val json.RawMessage // (unused variable error)
return nil
}`
UnmashalJSON method is causing an issue for checking of all the attribute(struct) throwing error, if not provided value for it, all the attribute become mandatory.
Example : `func (r *GfastPortReason) UnmarshalJSON(data []byte) error {
var fields map[string]json.RawMessage
if err := json.Unmarshal(data, &fields); err != nil {
return err
}
var val json.RawMessage
val = func() json.RawMessage {
if v, ok := fields["reason"]; ok {
return v
}
return nil
}()
if val != nil {
if err := json.Unmarshal([]byte(val), &r.Reason); err != nil {
return err
}
} else {
return fmt.Errorf("no value specified for reason")
}
val = func() json.RawMessage {
if v, ok := fields["description"]; ok {
return v
}
return nil
}()
if val != nil {
if err := json.Unmarshal([]byte(val), &r.Description); err != nil {
return err
}
} else {
return fmt.Errorf("no value specified for description")
}
return nil
}`
The text was updated successfully, but these errors were encountered: