graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

Clarify validation rule on non-null type wrapping another non-null type

Open polarina opened this issue 2 years ago • 3 comments

The specification states that:

A Non-Null type must not wrap another Non-Null type.

In the specification we see the type [Int!]! used in an example, which is a non-null list type that wraps another non-null named type.

The validation rule cannot hold and the example be valid simultaneously.

polarina avatar Oct 11 '22 17:10 polarina

The example is a non-null type wrapping a list type that wraps a non-null type (allowed) rather than a non-null type directly wrapping a non-null type.

yaacovCR avatar Oct 11 '22 17:10 yaacovCR

The example is a non-null type wrapping a list type that wraps a non-null type (allowed) rather than a non-null type directly wrapping a non-null type.

How would one hypothetically define a non-null type that directly wraps another non-null type, while also being grammatically correct?

The only counter-example I can currently think of is Int!!, but the grammar doesn't allow such a production.

polarina avatar Oct 12 '22 08:10 polarina

I don't think there is such an example -- such that the SDL constraint in this regard matches the type system constraint.

yaacovCR avatar Oct 12 '22 10:10 yaacovCR