Skip to content

WithWise/hmrc-api-bundler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HMRC API bundler

This project provides a dockerized workaround solution to the incomplete HMRC API bundle problem.

Solution overview

The project generates OpenAPI bundles from the HMRC API repos by running the API services and using redocly with the API URLs directly.

Running the services will resolve feature switch handlebars that are used in the original sources.

We use redocly instead of swagger-parser, because the latter seems to be unable to resolve all $ref references in the original specs.

Important note

The project is WIP. Redocly runs with default settings and returns a lot of linter issues.

Usage

  • add the repos you want to generate bundles for to REPOS in generate_bundles.sh.
  • run the container
make run
  • run the bundle generator script inside the container
./generate_bundles.sh
  • generated bundles are available in ./bundles folder
  • sbt and redocly logs are available in ./logs folder

Details

docker image

To be able to run the API services we need Scala and sbt, so we use a base image from https://github.com/sbt/docker-sbt.

Next, we need to install Node.js and redocly, then set the user to sbtuser.

docker compose

The api-bundler service is built from the dockerfile, and when ran with docker compose run --rm api-bundler it lands the user in bash.

The whole home folder is persisted, so that we don't need to pull the full repos with each execution and to take advantage of incremental sbt builds.

./bundles and ./logs folders are mounted so that results can be used outside the container.

generator script

This is where the real work gets done. It starts by updating all repos, then starts the API services and finally generates the bundles. All of these happen in parallel for each repo.

If you suspect that the process hangs (first build for sbt can take long), then check the log files, because sbt and redocly logs only go to file, not to the console.

About

HMRC API bundler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors