fix(composition): propagate directives from @interfaceObject fields to @external implementations#3456
fix(composition): propagate directives from @interfaceObject fields to @external implementations#3456dariuszkuc wants to merge 3 commits into
Conversation
…@external implementations When an implementation re-declares a field as `@external` (e.g. to reference it in `@requires`), the field's only resolvable definition lives on the abstracting `@interfaceObject`. Directives like `@tag` applied there were not being propagated to the implementation's copy in the supergraph. During `add_interface_object_fields`, detect implementation fields where every `@join__field` is `external: true` and the field is provided by an `@interfaceObject`, then copy applicable directives onto the implementation field. <!-- [FED-1074](https://apollographql.atlassian.net/browse/FED-1074) -->
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 7b4300f496f84c46e2de5572 ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
🦋 Changeset detectedLatest commit: 9decd0d The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| for (const destArg of dest.arguments()) { | ||
| const subgraphArgs = mapSources(withoutExternal, f => f?.argument(destArg.name)); | ||
| this.mergeArgument(subgraphArgs, destArg); | ||
| if (someSources(withoutExternal, isDefined)) { |
There was a problem hiding this comment.
We should only merge below IF we have non external sources. Without this guard we end up merging access control directives twice -> once during normal merge field logic and then again when propagating @interfaceObject field directives.
When an implementation re-declares a field as
@external(e.g. to reference it in@requires), the field's only resolvable definition lives on the abstracting@interfaceObject. Directives like@tagapplied there were not being propagated to the implementation's copy in the supergraph.During
add_interface_object_fields, detect implementation fields where every@join__fieldisexternal: trueand the field is provided by an@interfaceObject, then copy applicable directives onto the implementation field.