Support alternative to @boundary
directive that is introspection-compatible.
#79
Labels
enhancement
New feature or request
Bramble relies on a custom directive called
@boundary
to determine which object types are shared across services and how to look up boundary objects by ID in queries. This was inspired in large part by Apollo Federation's syntax which relies on 4 custom directives for a similar purpose (see https://www.apollographql.com/docs/federation/federation-spec/#federation-schema-specification).The issues we have faced with this approach are substantial and are due the fact that directives are only part of the GraphQL IDL and not the GraphQL type system (as explained by Lee Byron in graphql/graphql-js#746 (comment)). This means that any tool that doesn't use the GraphQL IDL (e.g. any code-first implementation like graphql-js or Graphene) is de facto incompatible with Bramble.
In addition, even for systems that do support directives and can specify
@boundary
on objects and fields, we've had to rely on services communicating the IDL as a string through theService.schema
field (Apollo Federation does a similar thing with_Service.sdl
). This is a hack and makes life hard both for the services and Bramble itself.The alternative we should consider for 2.0 is extending Bramble's
Service
object type to expose fields describing which object types are boundary types and which root fields should be used to look them up.This change can be made in a backwards-compatible way. We should support both the directive and its alternative going forward.
The text was updated successfully, but these errors were encountered: