-
-
Notifications
You must be signed in to change notification settings - Fork 831
Description
I'm working on a tool that shows a visual diff between two GraphQL schemas (e.g the previous and current versions of the same schema). Added fields are marked in green color, deleted in red and modified in yellow. It's built on top of graphql-voyager and uses @graphql-inspector/core under the hood.
In order to display the deleted fields in Voyager I merge both schemas using mergeSchemas
from @graphql-tools/merge
.
The problem is that if e.g. Post.content
in schemaA
(the previous version of the schema) has the String!
(non-null) type, but Post.content
in schemaB
(the current version of the schema) has the String
(nullable) type, the Post.content
in the result of mergeSchemas
of [schemaA, schemaB]
(in that order) will have the String!
type (from the previous schemaA
), not the String
type (from the current schemaB
). See the image below.
Could you please add an option for mergeSchemas
that changes the behavior of merging non-null and nullable fields to use (override) the nullability from the latest schema from the array?