FAQ | This is a LIVE service | Changelog

Skip to content
Commit 929894f5 authored by Dr Rich Wareham's avatar Dr Rich Wareham
Browse files

feat: add the bones of an OpenAPI client generation mechanism

Add the start of a re-usable OpenAPI client generation mechanism. Add
two files: one which represents the repository-local customisation and
one which is the re-usable template. Add the start of some documentation
for the template with an eye to moving it to the guidebook.

The general idea is that getting OpenAPI clients *should* be as simple
as including an `openapi.yaml` file in the root of the repository. (Note
the name of the file was chosen because GitLab will automatically render
files so-named with swagger UI.)

For our specific use case we want to generate the schema dynamically and
so allow for this by means of customising an "openapi:schema" job whose
role is to ensure the schema is available to downstream jobs as a CI job
artefact. The default behaviour is simply to copy the schema from the
repository but we override it to use the DRF spectactular Django
management command. We use the `--fail-if-warn` flag to allow this job
to additionally act as a "test" test that schema generation succeeds
without warning.

Add in the plumbing to run the [openapi-generator CLI][1] but only use
it for the moment as an additional "test" job which validates the spec.

[1]: https://openapi-generator.tech/

The template has been written with an eye to adding to the common
pipeline and so that there can be zero configuration required to make
use of it. As such the template follows the rules of the common pipeline
in being "safe" to include with no side-effects unless it's triggered
and all CI variables and artefacts are appropriately namespaced.

Closes #24
parent 6bc86ce2
Loading
Loading
Loading
Pipeline #650777 passed with stages
in 4 minutes and 56 seconds
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment