Skip to content

feat(core)!: request body is bare JSON; response body key is 'schema' - #67

Merged
rizukirr merged 1 commit into
mainfrom
contract-format-request-schema
Jul 6, 2026
Merged

feat(core)!: request body is bare JSON; response body key is 'schema'#67
rizukirr merged 1 commit into
mainfrom
contract-format-request-schema

Conversation

@rizukirr

@rizukirr rizukirr commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Breaking contract-format change. Bodies are written more directly:

  • Request body is now the raw JSON payload written directly under
    request, with no example wrapper.
  • Response body moves from example to the response's schema key.
// before
"request":  { "example": { "name": "Rizki Rakasiwi" } },
"responses": [ { "code": 200, "description": "OK", "example": { "status": 200 } } ]

// after
"request":  { "name": "Rizki Rakasiwi" },
"responses": [ { "code": 200, "description": "OK", "schema": { "status": 200 } } ]

Changes

  • apic-core: JsonContent.request is now Option<Value> (the RequestBody
    wrapper struct is removed); Response.example renamed to Response.schema.
    Threaded through the edit model (from_contract / to_json), the Postman
    converter, and their tests.
  • CLI/TUI: the apic read renderer and the TUI editor read the new shape; the
    new-contract seed logic clears the new body keys (request / schema).
  • Examples: all example/ contracts migrated to the new shape.
  • Docs: README "Contract format" and CHANGELOG updated.

Old { "example": ... } body contracts do not carry over and must be updated
(there is no back-compat shim).

Notes

  • Documented under CHANGELOG [Unreleased]; the version is left at 0.4.0, bump
    to 0.5.0 (breaking) when you cut the next release.
  • v0.4.0 (already released) is untouched.

Tests

cargo fmt --all --check and cargo clippy --workspace --all-targets -- -D warnings are clean; cargo test --workspace passes (257 tests). Every migrated
example/ contract parses under the new format.

BREAKING: a request body is now the raw JSON payload directly under 'request'
(no 'example' wrapper), and a response body moves from 'example' to a 'schema'
key. Threaded through the on-disk format, edit model, Postman converter,
renderer, TUI/GUI, examples, and docs.
@rizukirr
rizukirr merged commit 1f59663 into main Jul 6, 2026
4 checks passed
@rizukirr
rizukirr deleted the contract-format-request-schema branch July 6, 2026 18:06
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