Repository navigation
test: check the apps' OBP-API calls against a contract and fix calls OBP-API does not serve - #15
Merged
simonredfern merged 18 commits intoNov 18, 2026
Conversation
…ipant and updating a system view OBP-API serves PUT .../messages/CHAT_MESSAGE_ID, DELETE .../participants/USER_ID and PUT /obp/v6.0.0/system-views/VIEW_ID. These tests ask for those paths and fail until the calls use them.
…ew on the paths OBP-API serves
Editing a message now sends PUT .../messages/{id} with the new content, removing a participant in API Manager sends DELETE .../participants/{user_id} (under the bank for a bank's room), and saving a system view sends PUT /obp/v6.0.0/system-views/{id}. OBP-API answered 404 on the paths used before, so none of the three worked. chatApiPaths gains message and participant.
…contract The four entries that had no documented endpoint now name PUT .../messages/CHAT_MESSAGE_ID (system and bank level), DELETE .../participants/USER_ID (system and bank level) and PUT /obp/v6.0.0/system-views/UPD_VIEW_ID, and the retaken snapshot (k8s.openbankproject.com, OBP-API 474d4bcc) finds each of them. Only the openapi.yaml variant of the resource docs is left without a documented endpoint.
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.
…reads
The scan now also sees ${V}/ builders, /obp/v${major}, '/obp/' + version, a '/obp' base constant, any /vN.N.N/ segment, /obp/dynamic-entity paths and .mjs/.cjs/.mts/.cts files. The lines it newly sees are listed under not_calls. contract.json says that scripts outside src are out of scope.
# Conflicts: # obp-api-contract/snapshot.json
A username is only unique at one identity provider, so GET users/username/USERNAME could not say which person was meant, and it is not in the v5.1.0 and later resource docs. The lookup now reads the caller's provider from users/current and asks for GET users/provider/PROVIDER/username/USERNAME.
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.
Adds
obp-api-contract/: every OBP-API call the apps make (portal, api-manager, cohort, conformator and its runner, and the shared package) is listed incontract.jsonwith its verb, path, source line and the response fields it reads, checked offline againstsnapshot.json(what OBP-API's resource docs document for those calls) byobpApiContract.test.ts.snapshot.pyretakes the snapshot from a running OBP-API and refuses to overwrite it when a call now matches another operation or none, so a breaking OBP-API change shows up as a failing test. The existing version guard still fails on any call below v5.1.0, and the scan also recognises paths assembled from pieces and${V}-style builders.Four calls are fixed. Three were not served by OBP-API: editing a chat message now uses
PUT .../chat-rooms/ID/messages/MESSAGE_ID(system and bank level), removing a chat participant usesDELETE .../participants/USER_ID, and updating a system view usesPUT /obp/v6.0.0/system-views/{id}. The fourth, Conformator's lookup of a User by username, now asks forGET /obp/v5.1.0/users/provider/PROVIDER/username/USERNAMEat the identity provider the signed-in person used, because a username is only unique within one provider. Not covered yet: the Organisations calls have no documented endpoint on the public instance and are recorded as undocumented until the OBP-API change that adds them is merged.