caelum0x aec57a4727 fix(toolgate): generate real example inputs for the catalog page's curl snippets
Every "Call it" curl snippet on the live /catalog page (the page a fresh
signup's docs_url sends a real developer to) hardcoded `{"input": {}}`
regardless of the tool's actual schema. A real developer copy-pasting any
of those snippets verbatim got an opaque 422 invalid_input on nearly every
tool with required fields -- 26 of 27, confirmed live against a running
switchyard-server. Same failure class as today's Turnstile bech32 bug: a
documented quickstart example that never actually worked.

Added Catalog::example_input(), used by catalog_page.rs's curl_snippet:
prefers the manifest's own documented example.input, otherwise derives a
placeholder covering every required property (handling anyOf alternatives
like ticker-or-cik, and pattern-aware string values so e.g. a `domain`
field gets "example.com" instead of a plain word that fails its own regex).

Verified live: rebuilt and ran switchyard-server with the in-memory store,
signed up for a real key via /v1/auth/signup, fetched the live /catalog
page, and replayed all 27 generated snippets verbatim as real HTTP
requests. Before the fix, the hardcoded body failed schema validation on
every tool with required input. After: 26/27 now pass validation and
return a real response from the real upstream (Wikipedia, arXiv, OpenAlex,
GitHub, HN Algolia, RDAP, DNS-over-HTTPS, Nominatim, Open-Meteo, Photon)
or a correct 402 from a real Mint hold attempt against a real mint-server
for the paid rally.email.verify path; the 1 remaining failure is a
legitimate byo_required/not-connected provider error, unrelated to input
shape. Also exercised the CLI (sy search/describe/call/balance/topup/cred/
bundle), MCP JSON-RPC round trip, and a real Mint-backed paid-call attempt
(real POST /v1/holds landing on a real mint-server, real 402) -- all
correct and unaffected by this change. cargo test --workspace: unchanged,
all green.
2026-10-25 02:53:24 +03:00
..