Apollo Federation Transform
federation
transform allows to add the resolvers and directives to conform to the federation specification. Much of the federation sourcecode could be reused ensuring it is compliant to the specification. This transform uses graphql-transform-federation
package.
#
How to use?Add the following configuration to your Mesh config file:
#
Add Reference Resolver as a Code FileIf you want to add more complex business logic, you can point to a code file that exports a resolver function.
./userResolveReference.js
You can check out our example that uses Federation as a merging strategy.
types
(type:Array of Object
, required):name
(type:String
, required)config
(type:Object
):keyFields
(type:Array of String
, required)extend
(type:Boolean
)fields
(type:Array of Object
, required):name
(type:String
, required)config
(type:Object
, required):external
(type:Boolean
)provides
(type:String
)required
(type:String
)
resolveReference
- One of:String
object
:targetSource
(type:String
, required)targetMethod
(type:String
, required)args
(type:JSON
, required)returnData
(type:String
)resultSelectedFields
(type:JSON
)resultSelectionSet
(type:String
)resultDepth
(type:Int
)