DEVPROD-9733 Add OpenAPI version to generated spec #8625
Merged
+96
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DEVPROD-9733
Description
S&I wanted some consistent versioning for our openapi generated spec (we use swaggo/swagger). This adds a second file that keeps track of the sha256 of the swagger.json and the current version number. If the sha256 changes, the version number gets incremented by one. This means we don't use semantic versioning for our swagger.json which goes against openapi specifications- but I don't think that's worrisome since the depending service seemingly only uses the version number for reliable historic builds.
Testing
I ran this which started the versioning at 2. I ran a duplicate task here and it generated a swagger.json with
version=2
again. Then I ran a third task that changes the swagger docs to a new title, and it generated a swagger.json withversion=3
.I also ran the script locally with simulated envs to confirm the behavior.