Pull requests / #2469
#2469 serve: reject array-root JSON instead of extracting a nested object
open · @bettercallcaleb · 0 comments · View on GitHub
Description
## Title
Issue: Resolves #2467
## Summary
With object-root structured output, `[{"answer":1},{"answer":2}]` currently succeeds as `{"answer":1}`, silently dropping the array and remaining elements.
## What changed
- `serve/structured.py`: Preserve a detected array root for existing object/schema validation instead of extracting a nested object. Keep prose and Markdown-fenced object extraction working.
- `serve/test_structured.py`: Add HTTP, streaming, schema, nested-array and bracketed-prose regression cases.
## Extra Notes
- Validation on Ubuntu 24.04: 365 regression tests passed with one pre-existing sampler-thread test excluded; that failure was reproduced on unmodified upstream `main`. An additional 12 tests passed without optional `jsonschema`.
- Differential checks: 25,000 valid object outputs unchanged; 25,000 array outputs rejected. `/v1/responses` tested in both streaming and non-streaming modes.
Related on this site
Quick links to related pages.