Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EES-5396 Sync public API OpenAPI changes with API docs #5445

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Conversation

ntsim
Copy link
Collaborator

@ntsim ntsim commented Dec 9, 2024

This PR adds a syncing mechanism to ensure that OpenAPI changes in the public API are documented in the API docs.

To enable this:

  1. The public API now generates its OpenAPI documents at build time using the Swashbuckle CLI.
  2. We use oasdiff to diff between the OpenAPI documents used by the API docs and those generated by the public API.
  3. If there are any changes in the diff, we fail the build pipeline as this means there are undocumented changes.
  4. To resolve any undocumented changes, developers need to copy over any changes from the public API to the relevant OpenAPI document in the API docs.

Once this diff has been resolved, the build can pass and deployment can proceed.

The API docs deployment has now been adjusted so that they are built during the build itself. We need to do this as

Related changes

  • Removed /api prefix from openapi-v1.json in the API docs.
  • Moved Swagger config into public API's Startup to enable the Swashbuckle CLI to work.

Other changes

  • Disabled Swagger UI in non-dev environments (i.e. test, pre-prod, prod). This is consistent with our other backend APIs and avoids any problems from hosting the Swagger UI (it's expensive to generate).

@ntsim ntsim force-pushed the ees-5396 branch 2 times, most recently from 57b6e4a to b09c5ca Compare December 9, 2024 18:20
azure-pipelines-main.yml Show resolved Hide resolved
ci/scripts/public-api-openapi-diff.sh Show resolved Hide resolved

set -u

# This script should be ran from inside the oasdiff Docker container.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick but should ran be run?

ci/scripts/public-api-openapi-diff.sh Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants