tdr-generated-graphql

Classes to be used by the graphql client to communicate with the TDR graphql API

License

License

MIT
GroupId

GroupId

uk.gov.nationalarchives
ArtifactId

ArtifactId

tdr-generated-graphql_2.12
Last Version

Last Version

0.0.33
Release Date

Release Date

Type

Type

jar
Description

Description

tdr-generated-graphql
Classes to be used by the graphql client to communicate with the TDR graphql API
Project URL

Project URL

https://github.com/nationalarchives/tdr-consignment-api-data
Project Organization

Project Organization

National Archives
Source Code Management

Source Code Management

https://github.com/nationalarchives/tdr-generated-graphql

Download tdr-generated-graphql_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/uk.gov.nationalarchives/tdr-generated-graphql_2.12/ -->
<dependency>
    <groupId>uk.gov.nationalarchives</groupId>
    <artifactId>tdr-generated-graphql_2.12</artifactId>
    <version>0.0.33</version>
</dependency>
// https://jarcasting.com/artifacts/uk.gov.nationalarchives/tdr-generated-graphql_2.12/
implementation 'uk.gov.nationalarchives:tdr-generated-graphql_2.12:0.0.33'
// https://jarcasting.com/artifacts/uk.gov.nationalarchives/tdr-generated-graphql_2.12/
implementation ("uk.gov.nationalarchives:tdr-generated-graphql_2.12:0.0.33")
'uk.gov.nationalarchives:tdr-generated-graphql_2.12:jar:0.0.33'
<dependency org="uk.gov.nationalarchives" name="tdr-generated-graphql_2.12" rev="0.0.33">
  <artifact name="tdr-generated-graphql_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='uk.gov.nationalarchives', module='tdr-generated-graphql_2.12', version='0.0.33')
)
libraryDependencies += "uk.gov.nationalarchives" % "tdr-generated-graphql_2.12" % "0.0.33"
[uk.gov.nationalarchives/tdr-generated-graphql_2.12 "0.0.33"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.8
org.sangria-graphql : sangria_2.12 jar 2.0.0-M3
io.circe : circe-core_2.12 jar 0.13.0
io.circe : circe-generic_2.12 jar 0.13.0

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.8

Project Modules

There are no modules declared in this project.

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:
  2. Run sbt graphqlSchemaGen in the consignment api project. This will generate a schema.graphql file in the target/sbt-graphql directory
  3. Copy this schema.graphql file
  4. Switch back to the generated-graphl repo
  5. Paste the file into the src/main/resources directory
  6. 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.
  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: 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

uk.gov.nationalarchives

The National Archives, UK

Official archive of the UK government. Discover our online collections, research guides and educational resources spanning 1,000 years

Versions

Version
0.0.33
0.0.32
0.0.31
0.0.30
0.0.29
0.0.28
0.0.27
0.0.26
0.0.25
0.0.24
0.0.23
0.0.22
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.14
0.0.13
0.0.12
0.0.1