Skip to content

Draft: Save an OpenAPI and Thing Description file in the testing job.

This MR generates an OpenAPI document (a machine-readable JSON description of the HTTP API) as well as a Thing Description (a higher-level JSON description of our API, organised by Thing) when the tests run.

This MR contains the following

  • Add a test to test_dummy_server.py that saves the Thing Description and OpenAPI documents
  • Add a function to integration_tests/testfile.py that saves the Thing Description and OpenAPI documents
  • Add artifacts to the CI job so they are saved and exposed.

Before merge:

  • Decide on better filenames/paths.
  • Decide which of the tests to keep - probably one is enough.
  • Decide whether it's OK to put this in with the tests, or whether it needs its own stage.
  • Validate the resulting JSON files in the tests. This ought to be straightforward for the Thing Description as there's a validator in LabThings. The OpenAPI file is generated by FastAPI so there may be less to gain from validating that.

Merge checklist:

  • All new/changed functions have up to date typehints and docstrings
  • Any UI updates have a before and after screenshot in the MR description
  • Unit testing of new functionality has similar or better coverage that similar existing code
  • This code has been tested on a microscope
    • With webapp has been recompiled (if changed)
    • With updated settings JSON (if changed)
    • SmartScan and live stitching work

Related issues:

This code was used to check !348.

Merge request reports

Loading