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
when schema contains a key with dot in it
a field in UnmarshalJSON function creating with dot (.) in it and getting code errors
like template.hardwareIdReceived := false in below snippet
func (strct *Attrs) UnmarshalJSON(b []byte) error {
template.hardwareIdReceived := false
var jsonMap map[string]json.RawMessage
if err := json.Unmarshal(b, &jsonMap); err != nil {
return err
}
// parse all the defined properties
for k, v := range jsonMap {
switch k {
case "template.hardwareId":
if err := json.Unmarshal([]byte(v), &strct.TemplateHardwareId); err != nil {
return err
}
template.hardwareIdReceived = true
}
}
// check if template.hardwareId (a required property) was received
if !template.hardwareIdReceived {
return errors.New("\"template.hardwareId\" is required but was not present")
}
return nil
}
is there any way to avoid it ?
The text was updated successfully, but these errors were encountered:
@a-h the problem happens on code generation. The variable generated for required attributes uses the json attribute name directly instead of converting to a safe go name using getGolangName
when schema contains a key with dot in it
a field in UnmarshalJSON function creating with dot (.) in it and getting code errors
like template.hardwareIdReceived := false in below snippet
is there any way to avoid it ?
The text was updated successfully, but these errors were encountered: