You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'd like to compose user directives in a standard way that mirrors what we've done in toAPISchema.
In general there are two cases we need to handle, executable directives which apply to queries and type system directives which apply to type system locations.
The rule for each is:
all executable directives are (potentially) merged, but they are merged by "intersection" across subgraphs and that means that a given definition may not "make it" in the supergraph if definitions are too inconsistent between subgraphs. Because we don't know when the directive will be used in queries, we need to restrict the definition so that no query will be forced to deal with a directive it doesn't understand.
For type system directives, it is safe to merge the locations by union since we know that any references to the directive will originate from the subgraphs themselves, and and a broader definition is not problematic.
If a directive definition has both type system and executable locations, composition will ignore the type system locations and merge the directive as an executable one, with only its executable locations
The default behavior should be to not compose user directives unless requested to during composition. Let's add an exposeDirectives argument to compose which takes a list of custom directives (we need to be able to support both core schema and regular directives). If a directive is present in the list, it will appear in the supergraph, otherwise not. Also, ensure that all directives specified as an argument are present in the schema of at least one subgraph to mitigate directive name typos.
There is probably work to be done in field merging as well to ensure that directives that are repeatable will get values from all subgraphs, and values that are not repeatable deterministically select a sane choice from one of the subgraphs.
The text was updated successfully, but these errors were encountered:
We'd like to compose user directives in a standard way that mirrors what we've done in
toAPISchema
.In general there are two cases we need to handle, executable directives which apply to queries and type system directives which apply to type system locations.
The rule for each is:
If a directive definition has both type system and executable locations, composition will ignore the type system locations and merge the directive as an executable one, with only its executable locations
The default behavior should be to not compose user directives unless requested to during composition. Let's add an
exposeDirectives
argument tocompose
which takes a list of custom directives (we need to be able to support both core schema and regular directives). If a directive is present in the list, it will appear in the supergraph, otherwise not. Also, ensure that all directives specified as an argument are present in the schema of at least one subgraph to mitigate directive name typos.There is probably work to be done in field merging as well to ensure that directives that are repeatable will get values from all subgraphs, and values that are not repeatable deterministically select a sane choice from one of the subgraphs.
The text was updated successfully, but these errors were encountered: