Skip to content

Commit

Permalink
Update UniquenessKey for when Element is/isn't nullable (#896)
Browse files Browse the repository at this point in the history
With a schema:
type Query {
  things1: [Thing] # Note the lack of "!"
}

type Subscription {
  things2: [Thing!] # Note the "!"
}

the UniquenessKey for the two lists is the same, which causes non-deterministic output.
  • Loading branch information
zannen committed Nov 11, 2019
1 parent 99a55da commit fd201a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion codegen/config/binder.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,12 @@ func (t *TypeReference) UniquenessKey() string {
nullability = "N"
}

return nullability + t.Definition.Name + "2" + templates.TypeIdentifier(t.GO)
var elemNullability = ""
if t.GQL.Elem != nil && t.GQL.Elem.NonNull {
// Fix for #896
elemNullability = "ᚄ"
}
return nullability + t.Definition.Name + "2" + templates.TypeIdentifier(t.GO) + elemNullability
}

func (t *TypeReference) MarshalFunc() string {
Expand Down

0 comments on commit fd201a8

Please sign in to comment.