Apollo Federation
The typescript-resolvers
plugin also supports Apollo Federation (opens in a new tab).
To use it, add federation: true
to your configuration:
import { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = {
generates: {
'./src/types.ts': {
plugins: ['typescript', 'typescript-resolvers'],
config: { federation: true }
}
}
}
export default config
It will add the required GraphQL directives to your codegen schema and generate a compatible resolvers signature for Apollo Federation.