FAQ | This is a LIVE service | Changelog

Skip to content
  • Dr Rich Wareham's avatar
    feat: add the bones of an OpenAPI client generation mechanism · 929894f5
    Dr Rich Wareham authored
    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
    929894f5
Loading