webonyx / graphql-php

PHP implementation of the GraphQL specification based on the reference implementation in JavaScript
https://webonyx.github.io/graphql-php
MIT License
4.64k stars 562 forks source link

OverlappingFieldsCanBeMerged throws an error when querying same field w/ and w/o attributes for different union types #1500

Open Orrison opened 10 months ago

Orrison commented 10 months ago

This is a well-known/discussed issue within the GraphQL community and much discussed here: https://github.com/graphql/graphql-js/issues/53

If querying the same field for different union types has the same name but different Type definitions, this should be possible without an alias. But it seems we are currently restricting that within the graphql-php implementation.

spawnia commented 9 months ago

We mostly do what graphql-js does. Can you find a test case for this in https://github.com/graphql/graphql-js/blob/main/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts or https://github.com/webonyx/graphql-php/blob/master/tests/Validator/OverlappingFieldsCanBeMergedTest.php?