Version Matrix

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

  • Add a new query file to src/main/graphql:
  • Add a schema file generated by the consignment api project. This will be generated in the target/sbt-graphql directory and should be copied into src/main/resources/schema.graphql
  • 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/uk.gov.nationalarchives/tdr-generated-graphql_2.13/[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...
"uk.gov.nationalarchives" %% "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.
  1. 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: https://medium.com/@alexishevia/the-magic-behind-npm-link-d94dcb3a81af

Releasing

  • Commit and push the new query file that sits in src/main/graphql
  • Open a pull request, and merge to master once it has been reviewed.
  • This project should be run manually in Jenkins.

To Run Jenkins Manually

  • Go to the TDR Graphql Code Generation job in Jenkins.
  • Click on 'Build with parameters'
  • Leave STAGE option as 'intg' and paste the schema from the consignemnt api repo into the SCHEMA section.
  • You can look at the console output when/after you run the jenkins build to help bug fix etc.

TDR Documentation

The full documentation for the TDR project can be found here