apollographql / apollographql/federation

Nested @provides directives are not recognized

Open
#416 3 comments 2 reactions 2 assignees Claimed by @jbaxleyiii View on GitHub
Dominant language
TypeScript
Stars
725
Forks
276
Avg merge
1h 47m
Merged PRs (30d)
1

Description

Apollo Gateway is failing to compose a schema with nested `@provides` directives. The following schemas should be valid but fail to compose in Gateway.

**Originating type (Service A)**
```graphql
type Thing @key(fields: "id") {
id: ID
subThing: SubThing
}

type SubThing @key(fields: "id") {
id: ID
name: String
}

extend type Query {
getThing: Thing
}
```

**Extending type (Service B)**
```graphql
extend type Query {
getExtendedThing: Thing @provides(fields: "subThing { name }")
}
extend type Thing @key(fields: "id") {
id: ID @external
subThing: SubThing @external @provides(fields: "name")
}

extend type SubThing @key(fields: "id") {
id: ID @external
name: String @external
}
```

Neither of the `@provides` directives are honored. This results in the following error:
```
This data graph is missing a valid configuration. [unified-search] SubThing.name -> is marked as @external but is not used by a @requires, @key, or @provides directive.
```

Versions
```json
@apollo/gateway: 0.14.1
@apollo/federation: 0.14.1
apollo-server: 2.12.0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.