Describe the bug
The fields_have_appropriate_selections validation presently allows the following selection:
With myUnion being a union type, this query returns the following payload:
{ "data": { "myUnion": {} } }
The spec would require a union type to make a selection.
Cause
The issue occurs here: https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb#L34
The cause of the issue is that the fields? check omits union types. To fix this validation, the check should use composite? instead of fields?.
Steps to resolution
Unfortunately this is a breaking change as sources that used to validate will now fail. Need to:
Describe the bug
The
fields_have_appropriate_selectionsvalidation presently allows the following selection:With
myUnionbeing a union type, this query returns the following payload:{ "data": { "myUnion": {} } }The spec would require a union type to make a selection.
Cause
The issue occurs here: https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb#L34
The cause of the issue is that the
fields?check omits union types. To fix this validation, the check should usecomposite?instead offields?.Steps to resolution
Unfortunately this is a breaking change as sources that used to validate will now fail. Need to:
FieldsWillMergevalidation #4403