Is it possible to use the apollo federation specification?

Hello,

i tried to extend a graphql type generated by strapi with a field from an other service but i found no documentation. For example i tried to add the @key directive.

@key(fields: "id") 

Strapi works with the apollo gateway so the apollo federation specification are implemented but how i extend the generated graphql schema?

Best regards, Uniiq

Does nobody have an idea?

Hey Uniiq, I’m about to embark on setting up strapi with apollo federation, so please take my answer with a pinch of salt, as I’m still in the tinkering phase.

As I understand it, this PR implemented support for apollo federation within strapi: Make Strapi GraphQL an implementing service for Federation by shaheinm · Pull Request #6146 · strapi/strapi · GitHub</t. Thus, if you pass “federation: true”, into ./config/plugins.js, you will enable federation. e.g.

module.exports = {
  //
  graphql: {
    endpoint: '/graphql',
    shadowCRUD: true,
    playgroundAlways: false,
    depthLimit: 7,
    amountLimit: 100,
    apolloServer: {
      tracing: false,
    },
    federation: true,
  },
};

After you have set up strapi as an implementing service you can introduce your own directives by customising the schema. Checkout the documentation here:GraphQL - Strapi Developer Documentation

Best,

dom