diff --git a/plugin/modelgen/models.gotpl b/plugin/modelgen/models.gotpl index b11146939b..4fba157e47 100644 --- a/plugin/modelgen/models.gotpl +++ b/plugin/modelgen/models.gotpl @@ -98,7 +98,12 @@ } func (e {{ goModelName .Name }}) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) + switch e.IsValid() { + case true: + fmt.Fprint(w, strconv.Quote(e.String())) + case false: + graphql.Null.MarshalGQL(w) + } } {{- end }}