From 3adb2f5581b54fbf4fc75e4545cf3b82b6cb8a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20VERDO=C3=8FA?= Date: Sat, 18 Jul 2020 18:39:32 +0200 Subject: [PATCH] Do not emit JSON when there is no error locations Just conform to the spec : 7.1.2 If an error can be associated to a particular point in the requested GraphQL document, it should contain an entry with the key locations.... --- gqlerrors/formatted.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gqlerrors/formatted.go b/gqlerrors/formatted.go index fb422b63..f14dd711 100644 --- a/gqlerrors/formatted.go +++ b/gqlerrors/formatted.go @@ -13,7 +13,7 @@ type ExtendedError interface { type FormattedError struct { Message string `json:"message"` - Locations []location.SourceLocation `json:"locations"` + Locations []location.SourceLocation `json:"locations,omitempty"` Path []interface{} `json:"path,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` originalError error