How to merge multiple schema files into one for CI pipeline?

We are usng ‘Spring for GraphQL’ to implement subgraph service with maven.

‘Spring for GraphQL’ is supporting multiple schema files (*.graphqls) under the location classpath:graphql/** , which is typically src/main/resources/graphql.

How to merge multiple schema files into one for CI pipeline ? Is there any standard maven plugin available ?

Hello :wave:
AFAIK there is no existing plugins to do it but it is pretty straightforward. You would need to write some short script/app to merge the schema + transform it to get the final federated schema.

Since you need the GraphQL schema artifact, it doesn’t really matter in which language you implement it (e.g. you could use JS graphql-tools, etc). In order to do it using GraphQL Java see

1 Like
  • Written a Java utility to merge multiple schema files including common schema file, to generate a single schema file
  • Used below maven command in our CI pipeline to generate a file with the given path
    • mvn exec:java -Dexec.mainClass=“” -Dexec.args=“./schema.graphql”