apollographql / apollo-rs

Spec compliant GraphQL Tools in Rust.
Apache License 2.0
566 stars 43 forks source link

fix(compiler): fix validation for fragment spread of interface without implementers #896

Closed goto-bus-stop closed 2 weeks ago

goto-bus-stop commented 3 weeks ago

This Intf has no implementations. As written in the spec, doing a ... on Intf fragment spread should never work, as the set of possible types is empty and can never intersect with the parent type. However, implementations like graphql-js and graphql-go have an early check, accepting the fragment if the type condition is equal to the parent type. This tests reproduces that.

We may want to align with graphql-js and graphql-go rather than the spec here for compatibility? Though it's not something that's likely to happen in the real world.

Ref https://github.com/graphql/graphql-spec/issues/1109

duckki commented 3 weeks ago

I agree that Apollo's validator is spec-compliant currently, while others are not :)

At the same time, this could be an oversight in the spec. It's good to be able to test queries before writing an implementation (despite the weirdness of conditioning on the parent type).