Skip to content

Preserve OpenAPI JSON examples during x402 endpoint probing - #1256

Open
epistemedeus wants to merge 2 commits into
Merit-Systems:mainfrom
epistemedeus:codex/prefer-openapi-media-example
Open

epistemedeus wants to merge 2 commits into
Merit-Systems:mainfrom
epistemedeus:codex/prefer-openapi-media-example

Conversation

@epistemedeus

Copy link
Copy Markdown

Problem

Addresses #1255. Body-dependent x402 endpoints can be missed when discovery strips a declared OpenAPI media-type example and the probe falls back to synthesized placeholder values.

Change

  • Prefer a declared object example from application/json when reconstructing the probe body from the original OpenAPI document.
  • Preserve explicit caller-provided samples and the existing schema-synthesis fallback.
  • Keep the existing POST/GET/PUT/PATCH/DELETE preference; do not send form/XML examples as JSON.
  • Cover the actual probeX402Endpoint fallback handoff, not only the example selector.

Verification

pnpm exec vitest run src/lib/discovery: 92 tests passed across 9 files on Node22, including caller precedence, unavailable-document synthesis fallback, JSON-only selection and method order.

The original worker also reproduced the reported unpaid HTTP controls: the documented AcqPath body returned402, the synthesized max_total_micro: "test" returned400, and a placeholder resource with a valid amount returned422. No payment was made. This is probe compatibility, not a claim that the registration UI was exercised.

A full repository typecheck is not claimed: the worker checkout lacked generated Prisma types and reported pre-existing/setup errors outside the changed files.

pilot-heavy-worker and others added 2 commits October 4, 2026 21:06
Discovery 1.7.5 returns the JSON schema without the sibling example, so
the probe synthesized a placeholder URI and the string "test". Use the
document example before those defaults, and do not fetch externalValue.
@vercel

vercel Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

@epistemedeus is attempting to deploy a commit to the Merit Systems Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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