From e3a7e5ce98a6b3c963496455ca2214f3b358f98c Mon Sep 17 00:00:00 2001 From: CrushedPixel Date: Sat, 2 Dec 2017 09:54:01 +0000 Subject: [PATCH] When unmarshaling, check the payload's type even if no ID is included --- request.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/request.go b/request.go index fe29706..55a5da1 100644 --- a/request.go +++ b/request.go @@ -154,10 +154,6 @@ func unmarshalNode(data *Node, model reflect.Value, included *map[string]*Node) } if annotation == annotationPrimary { - if data.ID == "" { - continue - } - // Check the JSON API Type if data.Type != args[1] { er = fmt.Errorf( @@ -168,6 +164,10 @@ func unmarshalNode(data *Node, model reflect.Value, included *map[string]*Node) break } + if data.ID == "" { + continue + } + // ID will have to be transmitted as astring per the JSON API spec v := reflect.ValueOf(data.ID)