ci: add openapi spec drift check against fixture schema#4961
Closed
mandarini wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this is
What maintainers need to do
withTools.pg-17+withPgrstfromnix/tools/).openapi-snapshotartifact from the failing run; save astest/spec/fixtures/openapi-snapshot.json; commit.postgrest-with-pg-17 --fixtures test/spec/fixtures/load.sql postgrest-with-pgrst test/openapi-drift-check.sh, commit the resulting snapshot.test/spec/fixtures/openapi-snapshot.json. The existingtest/spec/fixtures/openapi.jsonis the draft-04 JSON Schema used by spec tests, not the spec itself, so a different name is used. Happy to relocate if preferred.What it's used for
What was added and why
test/openapi-drift-check.sh— bash script that curls the emitted spec viaPGRST_SERVER_UNIX_SOCKETand either writes (default) the committed snapshot or--checks against it. Always writes the live spec to a gitignored.generated.jsonpath so CI can upload it as an artifact regardless of pass/fail..github/workflows/openapi.yml— runs the script in--checkmode inside the existing Nix devShell. Triggers are narrow (only spec-affecting fixture files;data.sqlexcluded) so the 10–20 min build cost only hits relevant PRs..gitignore— adds the*.generated.jsonside-by-side path.Security posture
CACHIX_AUTH_TOKENtosetup-nix. cachix-action falls back toskipPush=truewhen no token is set, so cache pulls still work (this workflow's only need) while no push token is exposed to scripts running under the job. Please don't add the token back without considering this.permissions: contents: readat both workflow and job scope; no other permissions are granted.CODEOWNERSentry requiring maintainer review for.github/workflows/openapi.yml,test/openapi-drift-check.sh, andtest/spec/fixtures/openapi-snapshot.json, so that any future modifications to the gate itself get the same scrutiny as production code.