From f63a032a8aebfee3116ffcfada40c00db9290c9f Mon Sep 17 00:00:00 2001 From: Netra Mali Date: Fri, 24 Jan 2025 10:15:36 -0500 Subject: [PATCH] addressed comments --- request.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/request.go b/request.go index 0fed712..35cb590 100644 --- a/request.go +++ b/request.go @@ -493,7 +493,7 @@ func unmarshalNode(data *Node, model reflect.Value, included *map[string]*Node) // this indicates disassociating the relationship isExplicitNull = true } else if relationshipDecodeErr != nil { - fmt.Printf("decode err %v\n", relationshipDecodeErr) + er = fmt.Errorf("decode err %v\n", relationshipDecodeErr) } // This will hold either the value of the choice type model or the actual @@ -517,11 +517,11 @@ func unmarshalNode(data *Node, model reflect.Value, included *map[string]*Node) if relationship.Data == nil { // Explicit null supplied for the field value - // If a nullable relationship we set the - if isExplicitNull && strings.HasPrefix(fieldType.Type.Name(), "NullableRelationship[") { - fieldValue.Set(reflect.MakeMapWithSize(fieldValue.Type(), 1)) - fieldValue.SetMapIndex(reflect.ValueOf(false), m) - } + // If a nullable relationship we set the field value to a map with a single entry + if isExplicitNull { + fieldValue.Set(reflect.MakeMapWithSize(fieldValue.Type(), 1)) + fieldValue.SetMapIndex(reflect.ValueOf(false), m) + } continue }