Review a changed order response
This synthetic packet contains one baseline order response and three variations for GET /orders/order_demo_001. All four responses have status 200 and valid JSON. Run its local Node.js check to see whether each response satisfies one USD-only checkout's declared requirements. The check reads files only; it makes no network requests or Gostly calls. It does not run a Gostly session comparison or a CI workflow.
Download the packet and check
- Download order-response-cases.json and check-order-contract.mjs into the same directory. The authored packet is version
1.0.0; it contains no captured provider traffic. - Review the
usd-ready-order-v1contract. It requires HTTP 200, a JSON object body, the requested order ID, a non-negative safe-integeramount_minor,currency: USDandstatus: ready. It permits unrelated fields and does not require the amount to remain exactly 4200. The check does not coerce strings into numbers. - Run each case with Node.js:
node check-order-contract.mjs order-response-cases.json baseline
node check-order-contract.mjs order-response-cases.json optional_trace
node check-order-contract.mjs order-response-cases.json amount_as_string
node check-order-contract.mjs order-response-cases.json currency_changedRead the expected results
| Case | Difference | Expected check result | Reason |
|---|---|---|---|
baseline | Original authored response | accepted, exit 0 | Requested order, integer amount, USD and ready status satisfy this contract. |
optional_trace | Adds the top-level string trace_id | accepted, exit 0 | This consumer permits unrelated fields and does not use trace_id to make its decision. |
amount_as_string | Changes amount_minor from integer to string | refused with a reason, exit 1 | The consumer requires a non-negative safe integer and does not coerce the string. |
currency_changed | Changes currency from USD to EUR with the same JSON shape | refused with a reason, exit 1 | This checkout accepts USD only. EUR is not universally invalid API behavior. |
Omitting the case name selects baseline. Unknown cases, unreadable files and invalid packet input produce an input error and exit 1. The same assertions apply to every selected response, including the baseline; the checker does not look up an expected answer by case name. You can call its exported checkOrderContract function from your test harness.
A schema that only requires a currency string would not express the USD-only rule; a stronger schema could. Passing this check establishes only its declared requirements. For your application, adapt the contract and add the actual application assertion, such as correct currency display and availability of the fulfilment action.
Inspect the complete response packet
{
"format": "gostly.synthetic-order-responses.v1",
"packet_version": "1.0.0",
"synthetic": true,
"provenance": "Authored response specimens for a reader-owned consumer-contract exercise; no captured provider traffic.",
"request": {
"method": "GET",
"path": "/orders/order_demo_001",
"scope": "Illustrative request for one synthetic order, not a Gostly control endpoint."
},
"cases": {
"baseline": {
"status": 200,
"body": {
"id": "order_demo_001",
"amount_minor": 4200,
"currency": "USD",
"status": "ready"
}
},
"optional_trace": {
"status": 200,
"body": {
"id": "order_demo_001",
"amount_minor": 4200,
"currency": "USD",
"status": "ready",
"trace_id": "trace_demo_002"
}
},
"amount_as_string": {
"status": 200,
"body": {
"id": "order_demo_001",
"amount_minor": "4200",
"currency": "USD",
"status": "ready"
}
},
"currency_changed": {
"status": 200,
"body": {
"id": "order_demo_001",
"amount_minor": 4200,
"currency": "EUR",
"status": "ready"
}
}
}
}Record the baseline decision
Accepting an observation, acknowledging a drift event and replacing a baseline are separate actions. This consumer can accept the optional trace field while retaining its baseline. For the string amount or changed currency, hold the baseline while the contract owner investigates whether to fix the source, change the client or deliberately revise its rules.
Record source identity and version, request coverage, the affected application assertion and a named contract owner. Re-record when a relevant upstream or request-contract change needs a representative observation, rather than only to make a failing check pass. This packet covers one order response; authentication, writes and the full workflow are outside its coverage.
BASELINE REVIEW RECORD · fill in for your own observation
Contract: usd-ready-order-v1
Contract owner: [named checkout maintainer]
Consumer/application revision: [revision under review]
Observed source: authored synthetic packet 1.0.0, case [case name]
Real-source equivalent: [service, capture/session IDs, source version]
Request: GET /orders/order_demo_001
Coverage: one order response; no authentication, writes or full workflow
Affected check: checkOrderContract + [your application assertion]
Proposed disposition: [keep baseline / accept observation / revise contract]
Reason and unresolved coverage: [record the evidence]
Re-record trigger: [the relevant upstream or request-contract change]
Baseline replacement: only after the owner records the deliberate decisionFor your own recorded interaction, follow Re-record and compare. Keep the intended service, session IDs, attributable rows and representative coverage with the result, then verify replay origin and the affected client assertion.