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.
- 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
- Download the latest graphql schema file into the
src/main/resources
directory - Run the following commands to allow you to check that your changes work locally before submitting them:
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...
The following commands create a symbolic link to the generated Typescript version of the schema.
- In this project:
cd ts
- In the ts directory:
npm run codegen
- In the ts directory:
npm link
- From the output of this command copy the following line:
@nationalarchives/tdr-generated-graphql
.
- From the output of this command copy the following line:
- 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
- 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, thets-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.
- 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.
The full documentation for the TDR project can be found here