- This release imports the
sbt-scrooge-typescript 1.4.0sbt plugin which has the potential to introduce some breaking changes for generated typescript mappings via thrift 0.13.0, specifically related to the handling ofInt64data.
This repo uses gha-scala-library-release-workflow
to automate publishing releases (both full & preview releases) - see
Making a Release.
The content-api-models project builds the following bundles:
-
content-api-models-scala - A jar containing Scrooge generated class files based on the Thrift definitions of the content api models found in the
content-api-modelsdependency. -
content-api-models-json - A jar containing JSON serializers and deserializers. Used internally by the content api and also by the
content-api-scala-clientto convert from Elasticsearch returned json to the Scrooge-generated Thrift classes. As a client you should never need to depend on this explicitly, although you may have a transitive dependency on it if using thecontent-api-scala-client. -
content-api-models - A jar containing the Thrift definitions of the content api models only. As a client it is unlikely that you should ever need to depend on this but rather use the
content-api-models-scaladependency instead. -
@guardian/content-api-models - An npm package containing the generated models and their type definitions.
To publish a snapshot version locally.
sbt +publishLocal
There are two sets of tests in this repository: tests in CirceRoundTripSpec.scala which test the JSON encoders and decoders, and tests in ThriftRoundTripSpec.scala which test the thrift serialisation and deserialisation (across the binary and compact protocols).
These tests verify that output from old versions of this library can still be decoded by the current version, and that the resulting output from the current version is the same. If these tests pass on a PR, you can be reasonably confident that the changes in the PR won’t break consumers of content-api-models-scala or content-api-models-json. (One limitation of these tests is that they don’t cover the entirety of the model. For example, if a PR changes a field from optional to required in a struct which is not covered by the tests, the tests will still pass.)
There aren’t any tests here of content-api-models-typescript, but that functionality is tested in scrooge-extras.
This repository is cross-compiled for scala 2.12 and 2.13, so the CI workflow uses sbt +test to run the tests against all versions in crossScalaVersions.
You can also run the tests for a specific Scala version if necessary:
sbt ++2.12.11 test