Skip to content

docs: show the JSON request and response bodies on the resource pages - #77

Merged
justpilot merged 1 commit into
4.xfrom
docs/json-examples
Oct 26, 2026
Merged

justpilot merged 1 commit into
4.xfrom
docs/json-examples

Conversation

@justpilot

Copy link
Copy Markdown
Owner

Billomat's API docs only show XML. The resource pages now have a JSON on the wire section (VitePress code group):

  • Requests: tools/generate-json-examples.php calls the SDK against a mock client and writes the captured body to docs/snippets/json/ (23 examples: create calls of all main resources and sub-resources, settings update). They show exactly what the SDK sends: envelope, wire field names, money as strings, parent IDs.
  • Responses: the anonymized sandbox responses from tests/Fixtures/Contract are imported with <<< @/../tests/...; empty lists are left out.
  • The section between the json-examples markers is generated (31 pages). composer docs:json writes, composer docs:json:check runs in the quality job and in composer ci.
  • The docs workflow also runs when tests/Fixtures/Contract/** changes.

Gap: the sandbox has no offers, credit notes, letters, reminders, recurrings, incomings, articles or contacts, so those pages only show the request for now.

Test plan

  • composer docs:json:check, docs build (code groups render with the expected tabs), lint, PHPStan, Rector

tools/generate-json-examples.php captures the request bodies from the SDK
(docs/snippets/json/) and writes a "JSON on the wire" section into 31 resource
pages, with the contract fixtures as response examples. composer docs:json:check
runs in CI, so the examples follow the serialization. The docs workflow also
rebuilds when the contract fixtures change.
@justpilot
justpilot merged commit 6b380eb into 4.x Oct 26, 2026
8 of 9 checks passed
@justpilot
justpilot deleted the docs/json-examples branch October 26, 2026 15:55
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.

1 participant