Repository navigation
Conversation
A literal path segment also matches a documented placeholder, so a call whose own endpoint is gone could match a neighbouring endpoint when the snapshot is retaken, and the tests would pass against the wrong fields. snapshot.py now compares each call's operation with the snapshot.json already on disk: if one differs it lists the calls and writes nothing, unless --accept-rebind is given. A path with no /obp/vX.Y.Z prefix is recorded as missing and unversioned instead of stopping the script. The file is the same in every repository that keeps an OBP-API contract.
…nt call not listed
…d of the generated file
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.
This adds an OBP-API contract for the calls OBP-MCP makes on its own: obp-api-contract/contract.json lists each of them (root, glossary, resource docs and swagger, at the default DEFAULT_API_VERSION v7.0.0) with its source file, the text that makes the call and the response fields the code reads, and obp-api-contract/snapshot.json records what an OBP-API documents for those endpoints. tests/test_obp_api_contract.py checks offline, as part of
uv run pytest, that every listed call is still in its file, that every string in src/, database/ and scripts/ that builds an OBP-API path belongs to a listed call, that the paths use DEFAULT_API_VERSION, that the snapshot matches the contract, and that every endpoint and every field read is documented; it fails when a new call is added without a contract entry or when a retaken snapshot shows an endpoint or field gone. Fields OBP-API returns but does not document (the resource-docs and swagger bodies) are listed in undocumented_fields, and the test fails once they become documented so the list shrinks.To check a new OBP-API build, run
python3 -I obp-api-contract/snapshot.py --base https://k8s.openbankproject.com(anonymous GETs of the public resource docs and root, standard library only) and rerun the tests. The generic call_obp_api tool is not listed, since its endpoint is chosen by the user from the index and its version is already moved up to v5.1.0 by the existing floor in src/tools/endpoint_index.py..github/workflows/tests.ymlruns the whole suite (124 tests) on every pull request withuv sync --frozen; the endpoint index tests now build their index from sample resource docs, becausedatabase/endpoint_index.jsonis generated from a running OBP-API and is not in the repository.