A gateway says it supports JSON output. Does it enforce your schema?
Parseability is not schema conformance. Test request parameters, output structure, and business rules separately before going live.
If model output feeds a database, job queue, or form, one attractive JSON response does not prove an integration is ready. Parsing, schema conformance, and suitability for a business action are three different checks. For ticket routing, {"queue":"billing","priority":"2"} parses, but the string fails if priority must be an integer. Even a valid integer does not make automatic dispatch appropriate when the ticket lacks evidence.
Write a contract you can actually test
Start with two fields: queue must be billing, support, or unknown; priority must be an integer. Require both fields and disallow undeclared keys. JSON Schema's properties does not make fields mandatory on its own; use required. A null value is not the same as an absent key, and is invalid where an integer is expected. additionalProperties: false rejects keys not declared in this schema. 1
Treat this schema as the application's acceptance contract, not necessarily a payload you can send unchanged to every service. Ask which structured-output setting works for your exact model and endpoint, which keywords are supported, and what happens when a configuration is unsupported: explicit error or altered behavior. Different endpoints may use different request fields. Record the model ID, protocol, streaming mode, and date. Do not generalize one route's results to every model.
Test each layer with positive and negative fixtures
- Start with the local validator. Feed it a passing object and five failing fixtures: a missing property, a number encoded as a string, an invalid enum, an extra key, and explicit
null. Use fixed objects rather than hoping the model happens to produce a bad answer. If a bad fixture passes, fix the validator before judging the gateway. Version the fixtures alongside the deployed schema so changes to the contract and its tests stay together.
- Check request handling. Send the smallest schema with a confirmed model and endpoint. Record the status, error shape, and actual extracted model output separately. In a test environment, check what happens with a configuration the provider explicitly does not support. HTTP 200 alone does not show that the schema setting took effect. Do not silently fall back to prompt-only formatting just to get a pass.
- Exercise the whole path. Use clearly classifiable tickets, ambiguous tickets, and source text with quotes or line breaks. If production streams, include streaming: wait for the complete result and terminal state before parsing. Route refusals, truncation, and parse failures separately rather than writing default tickets.
Keep business validation after launch
A valid shape does not make the answer correct. A billing value can pass the enum even when the ticket only says “I need help.” Start with human review for a small sample and measure schema pass rate separately from agreement with reviewers. For troubleshooting, record only the model, endpoint, schema version, request ID, and failure class you need; do not dump full tickets into routine logs.
If you have a fallback model, repeat the tests on both routes. A fallback that only promises ordinary JSON should not silently feed a strict-schema write path. Queue it for review or mark the feature temporarily unavailable. The acceptance criterion is that bad output is blocked and handled deliberately, not that the result looks like JSON.
Sources & attribution
This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.
- Understanding JSON Schema: object — JSON Schema · accessed 2026-11-30Note:Object properties, required fields, extra keys, and null versus absence.
One key for Claude, GPT and 50+ models
The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.