Inline fragments not resolved within named fragments on a matching interface
My GraphQL query uses a named fragment on an interface implemented by a type returned from a field. When I create an inline fragment on the interface itself within the named fragment (the same interface), it is ignored.
This may be related to an issue I reported earlier https://github.com/graphql-hive/router/issues/944
Reproduction using the official SWAPI (https://github.com/graphql/swapi-graphql):
Supergraph:
```yaml
federation_version: =2.3.2
subgraphs:
swapi:
routing_url: https://graphql.org/graphql/
schema:
file: ./schema.graphql
```
Query:
```graphql
query test {
allFilms {
films {
...test
}
}
}
fragment test on Node {
...on Node {
id
}
...on Film {
director
}
}
```
The `id` field should be returned as a part of the result, but it is ignored and only `director` is present.
Modifying the named fragment `test` to be `on Film` fixes this, although both variants are legitimate.
关闭于 2026-05-11 2 条评论