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.
…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.
Contributor
Author
|
Merged into #15, which carries these commits together with the three call fixes. |
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 PR adds a contract between the apps and OBP-API, checked by the unit tests without a server.
obp-api-contract/contract.jsonlists the 644 OBP-API calls that the Portal, API Manager, Cohort and the shared package make, each with its verb, path, source file, the text in that file that makes the call, and the response fields the code reads. It also lists the source lines that name an OBP-API path without calling one, such as help text and path helpers.obp-api-contract/snapshot.jsonis what OBP-API documents for those calls, written bypython3 -I obp-api-contract/snapshot.py --base https://k8s.openbankproject.comfrom the public resource docs.packages/shared/src/lib/server/obp/obpApiContract.test.tsruns withnpm run test:unitand fails when a listed call is no longer in its file, when a source line builds an OBP-API path that the contract does not list, when the snapshot was taken for a different list, or when a call reaches no documented endpoint or reads a field the docs leave out. Known gaps are recorded per call inundocumented_endpointandundocumented_fields(5 endpoints and 83 calls with fields). A gap that OBP-API later documents also fails, so the record shrinks. To check a new OBP-API build, run snapshot.py against it and run the tests.Not covered yet: the Portal's Berlin Group and UK Open Banking calls, calls through the generic proxy whose path the browser chooses, and records of the Dynamic Entities the apps define themselves.