Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinconaway committed Mar 13, 2024
1 parent e5c765f commit ff6d042
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,19 @@ func (ro *resourceObject) unmarshalFields(v any, rv reflect.Value, rt reflect.Ty
fv := rv.Field(i)
ft := rt.Field(i)

jsonapiTag, err := parseJSONAPITag(ft)
if err != nil {
return err
}
// If there is an embedded struct we want to process the fields in that struct recursively
if fv.Kind() == reflect.Struct {
// only if there isn't a relationship defined on the field.
if fv.Kind() == reflect.Struct && jsonapiTag == nil {
if err := ro.unmarshalFields(v, fv, reflect.TypeOf(fv.Interface()), m); err != nil {
return err
}
continue
}

jsonapiTag, err := parseJSONAPITag(ft)
if err != nil {
return err
}
if jsonapiTag == nil {
continue
}
Expand Down

0 comments on commit ff6d042

Please sign in to comment.