fix: Adds support for defining Interface entities resolvers #262
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
As part of the Federation v2.3 spec, the Apollo team added a new feature, to support defining and referencing Entities that are interfaces. You can read more about this here, and check the initial implementation here.
This feature consists of two parts:
@interfaceObject
directive. This work was added in feat: adds support for the@interfaceObject
directive #218Description
Union
inGraphQL
can't be anInterface
according to the spec, but at the same time, according to the Apollo Federation spec, an interface can be an Entity, and an Entity is an Union. Therefore, we have to extend the validation (assert_valid_union_member
) for the Entity union to allowInterfaces
(more preciselyModules
) as possible types.@key
directive. This is a requirement from the spec.underscore_reference_keys
support to interfacesObject
class, it didn't also cover theInterface
module. This commit adds the sameunderscore_reference_keys
method to theInterface
module.Interface Entities
feature support.cc @nogates