Skip to content

test: check the apps' OBP-API calls against a contract and fix calls OBP-API does not serve - #15

Merged
simonredfern merged 18 commits into
OpenBankProject:mainfrom
hongwei1:fix/obp-api-unserved-calls
Nov 18, 2026
Merged

simonredfern merged 18 commits into
OpenBankProject:mainfrom
hongwei1:fix/obp-api-unserved-calls

Conversation

@hongwei1

@hongwei1 hongwei1 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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 in contract.json with its verb, path, source line and the response fields it reads, checked offline against snapshot.json (what OBP-API's resource docs document for those calls) by obpApiContract.test.ts. snapshot.py retakes 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 uses DELETE .../participants/USER_ID, and updating a system view uses PUT /obp/v6.0.0/system-views/{id}. The fourth, Conformator's lookup of a User by username, now asks for GET /obp/v5.1.0/users/provider/PROVIDER/username/USERNAME at 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.

…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
@hongwei1 hongwei1 changed the title fix: call the OBP-API paths that edit a chat message, remove a participant and update a system view test: check the apps' OBP-API calls against a contract and fix three calls OBP-API does not serve Nov 18, 2026
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.
@hongwei1 hongwei1 changed the title test: check the apps' OBP-API calls against a contract and fix three calls OBP-API does not serve test: check the apps' OBP-API calls against a contract and fix calls OBP-API does not serve Nov 18, 2026
@simonredfern
simonredfern merged commit 21733de into OpenBankProject:main Nov 18, 2026
1 check passed
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