{
"description": "Bodies that the Rust type and the generated Python model must both accept or both reject. A request is accepted when it parses and passes the frontend's validation. A case marked `frontend_only` is rejected by the frontend alone and accepted by the generated model: an unknown value of a request enum the worker does not read, which it must accept from a newer frontend. Not a case here: `speed: null`, which the frontend reads as 1.0 and forwards as a number, so a worker never receives it.",
"cases": [
{"name": "minimal", "type": "request", "valid": true, "body": {"input": "hi"}},
{"name": "speed-as-json-integer", "type": "request", "valid": true, "body": {"input": "hi", "speed": 2}},
{"name": "speed-lower-bound", "type": "request", "valid": true, "body": {"input": "hi", "speed": 0.25}},
{"name": "speed-upper-bound", "type": "request", "valid": true, "body": {"input": "hi", "speed": 4.0}},
{"name": "data-source-url", "type": "request", "valid": true, "body": {"input": "hi", "data_source": "url"}},
{"name": "max-new-tokens", "type": "request", "valid": true, "body": {"input": "hi", "max_new_tokens": 2048}},
{"name": "nvext-chunking", "type": "request", "valid": true, "body": {"input": "hi", "nvext": {"frontend_accepts_audio_chunks": true}}},
{"name": "unknown-field-is-kept", "type": "request", "valid": true, "body": {"input": "hi", "emotion": "calm"}},
{"name": "missing-input", "type": "request", "valid": false, "body": {"model": "m"}},
{"name": "input-as-number", "type": "request", "valid": false, "body": {"input": 123}},
{"name": "speed-as-string", "type": "request", "valid": false, "body": {"input": "hi", "speed": "1.0"}},
{"name": "speed-as-bool", "type": "request", "valid": false, "body": {"input": "hi", "speed": true}},
{"name": "speed-below-range", "type": "request", "valid": false, "body": {"input": "hi", "speed": 0.1}},
{"name": "speed-above-range", "type": "request", "valid": false, "body": {"input": "hi", "speed": 5.0}},
{"name": "data-source-unknown", "type": "request", "valid": false, "body": {"input": "hi", "data_source": "ftp"}},
{"name": "max-new-tokens-as-string", "type": "request", "valid": false, "body": {"input": "hi", "max_new_tokens": "2048"}},
{"name": "max-new-tokens-as-float", "type": "request", "valid": false, "body": {"input": "hi", "max_new_tokens": 2048.0}},
{"name": "voice-as-number", "type": "request", "valid": false, "body": {"input": "hi", "voice": 1}},
{"name": "nvext-chunking-as-string", "type": "request", "valid": false, "body": {"input": "hi", "nvext": {"frontend_accepts_audio_chunks": "true"}}},
{"name": "nvext-as-string", "type": "request", "valid": false, "body": {"input": "hi", "nvext": "none"}},
{"name": "minimal-with-defaults", "type": "response", "valid": true, "body": {"id": "r1", "model": "m", "created": 0}},
{"name": "with-data", "type": "response", "valid": true, "body": {"id": "r1", "model": "m", "created": 0, "data": [{"output_format": "wav", "b64_json": "AAA="}]}},
{"name": "inference-time-as-json-integer", "type": "response", "valid": true, "body": {"id": "r1", "model": "m", "created": 0, "inference_time_s": 2}},
{"name": "missing-id", "type": "response", "valid": false, "body": {"model": "m", "created": 0}},
{"name": "created-as-string", "type": "response", "valid": false, "body": {"id": "r1", "model": "m", "created": "0"}},
{"name": "progress-as-string", "type": "response", "valid": false, "body": {"id": "r1", "model": "m", "created": 0, "progress": "100"}},
{"name": "progress-as-float", "type": "response", "valid": false, "body": {"id": "r1", "model": "m", "created": 0, "progress": 100.5}},
{"name": "data-as-object", "type": "response", "valid": false, "body": {"id": "r1", "model": "m", "created": 0, "data": {}}},
{"name": "data-item-missing-output-format", "type": "response", "valid": false, "body": {"id": "r1", "model": "m", "created": 0, "data": [{"url": "https://example.com/a.wav"}]}},
{"name": "error-as-number", "type": "response", "valid": false, "body": {"id": "r1", "model": "m", "created": 0, "error": 500}}
]
}