TDR Generated GraphQL

This project generates, packages and deploys the case classes generated by the sbt-graphql project to the sonatype nexus.

These classes are used by other TDR repositories to communicate with the consignment API.

Building locally

  1. Add a new query file to src/main/graphql:
    • The file name should be in Pascal case e.g. FooBarBaz
    • The query/mutation name should be in Camel case e.g. fooBarBaz
  2. Download the latest graphql schema file into the src/main/resources directory
  3. Run the following commands to allow you to check that your changes work locally before submitting them:

Scala version

  • sbt package publishLocal

This will place a snapshot version of the built project jar in the local .ivy cache folder: $HOME/.ivy2/local/[version number]-SNAPSHOT

Other sbt projects that have this project as a dependency can access the local snapshot version by changing the version number in their build.sbt file, for example:

... other dependencies...
"" %% "tdr-generated-graphql" % "[version number]-SNAPSHOT"
... other dependences...

Typescript version

The following commands create a symbolic link to the generated Typescript version of the schema.

  1. In this project: cd ts
  2. In the ts directory: npm run codegen
  3. In the ts directory: npm link
    • From the output of this command copy the following line: @nationalarchives/tdr-generated-graphql.
  4. Navigate to the project that uses the generated schema in its Typescript code. In this project navigate to the relevant npm directory and run this command in that directory: npm link @nationalarchives/tdr-generated-graphql

See the following blog post for more information on npm link and instructions to undo the symbolic link:


  • Commit and push the new query file that sits in src/main/graphql
  • Open a pull request.
  • A job will run which will check to see if the changes are only within the ts directory. If they are, the ts-only label is added to the pull request.
  • If the pull request later changes to include other changes, the ts-only label is removed.
  • Merge the pull request to master once it has been reviewed.
  • If the PR has the ts-only label, the updated package is deployed to npm but not to maven.
  • If the PR doesn't have the ts-only label, updated packages are deployed to npm and maven.

To deploy Generated Graphql manually

  • Go to the TDR Deploy Generated Graphql on the GitHub Actions tab of this project.
  • Click on 'Run Workflow'.
  • Select green 'Run Workflow' button.
  • You should see the job running (if not, refresh the page).
  • Once it is complete (green tick), check the release tags to see the new version.
  • It should take about 15-30 minutes until it is published to Maven.
    • Note: the new release version is often available before it appears on the Maven GUI.

TDR Documentation

The full documentation for the TDR project can be found here