Enforce documented-required parameters and return the documented message field - #3
Merged
Merged
Conversation
An audit of all 30 endpoints against developer.epoint.az found 16 places where the sandbox accepted a payload production documents as invalid. language was defaulted to az on twelve endpoints, and display and save_as_template were defaulted on invoice create and update. This is the dangerous direction. The developer builds against a sandbox that accepts their incomplete request and only finds out on the switch to production. token/widget keeps its old behaviour: its doc page lists only public_key, amount, order_id and description.
Fifteen endpoints document message and none of them returned it, so an integration reading it got undefined here and a string in production. The production wording is unknown, so an empty string carries the shape and the gap is recorded as unverified.
The contract test only checked for fields the sandbox invents, never for documented fields it omits, so the message gap went unnoticed. Adds the missing direction, plus 63 cases asserting every documented-required field is enforced.
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.
A full audit of all 30 endpoints against
developer.epoint.az, extracting every documented request and response parameter from the scraped docs and probing the running container against them.What the audit found
16 places where the sandbox accepted a payload production documents as invalid. This is the dangerous direction: the developer builds against a sandbox that accepts their incomplete request and only finds out on the switch to production.
languageis documented Required on twelve endpoints and was defaulted toazdisplayandsave_as_templateare documented Required on invoice create and update, and were defaulted15 endpoints omitted the documented
messagefield. An integration reading it gotundefinedhere and a string in production. The production wording is unknown, so an empty string carries the shape and the gap is recorded as unverified.The contract test only guarded one direction. It checked for fields the sandbox invents but never for documented fields it omits, which is why the
messagegap sat unnoticed since the contract work landed.What did not change
token/widgetstill does not requirelanguage. Its doc page lists onlypublic_key,amount,order_idanddescription.card-registration-with-paystill withholds ten documented response fields. The documented "response" carriesrrn,bank_responseandoperation_code200, which can only exist once the customer has paid, so it reads as the callback payload mislabelled as the response. Guessing would invent data; it is recorded as unverified and needs a production capture.A note on strictness
Where the docs say Required and production might in fact be lenient, enforcing makes the sandbox stricter than production. That is the safe error: the developer sends the field and it works in both places. The unsafe error is the one being fixed here.
Verification
276 API tests, up from 203. 63 of the new ones assert every documented-required field is refused when omitted, and name the field in the refusal.
Re-ran the audit against a rebuilt container on a clean database with every feature granted: 85 omissions probed, 0 accepted. The response-field audit is clean apart from the deliberate withholding above.
Breaking
A request that omitted
language,displayorsave_as_templateused to succeed and now fails. That is the point, but it is a behaviour change for anyone already on 0.1.0.