Federation: alternative way to extend entities

I’m trying to migrate a monolithic graph to a federated one. I’ve found that some tools (graphql-codegen in particular) will combine any type extensions into a single type definition when outputting a GraphQL schema file, meaning the output schema is incorrect for use with Federation.

Currently to get federation working I’m having to check in my schema (which is generated from code, so usually wouldn’t be tracked in source control) and manually add back in the extends keyword to extended entities.

Could there any possible alternatives to using the extend type syntax to denote extending an entity in a subgraph for federation? Maybe an additional directive on the object type?

Can you add directives to types in your code-first graphql framework? The @extends directive is an alternative to using the extend keyword:

type MyEntity @key(fields: "id") @extends {
  id: ID! @external