[0.18.1 nightly] SAP silently drops array entries for compact unquoted object keys depending on whitespace
Environment
baml-cli 0.18.1-nightly.20260828.a, Linux x86_64- Reproduced with the CLI directly, without an LLM, network request, or language bridge.
baml.toml:[package]withname = "sap-repro"
Minimal reproduction
Put this in baml_src/main.baml and run baml test using that toolchain:
class PageRoute {
id: string,
schema_id: string?,
reason: string,
}
class PageRoutes {
routes: PageRoute[],
}
test "compact unquoted keys retain array entries" {
let expected = baml.sap.parse<PageRoutes>(`{"routes":[{"id":"001","schema_id":null,"reason":"amount -1.617,98"}]}`);
let spaced = baml.sap.parse<PageRoutes>(`{ routes: [ { id: "001", schema_id: null, reason: "amount -1.617,98" } ] }`);
let compact = baml.sap.parse<PageRoutes>(`{routes:[{id:"001",schema_id:null,reason:"amount -1.617,98"}]}`);
assert.equal(spaced, expected);
assert.equal(compact, expected)
}Actual
Quoted JSON and the spaced unquoted version return one route, retaining id: "001", null, and the signed decimal-comma amount string.
The compact unquoted version returns PageRoutes {routes: []} with no parse exception. The second assertion fails.
Another observed failing input is {routes: [{id: "001",schema_id: null,reason: "amount -1.617,98"}]}. Conversely, {routes:[{id: "001", schema_id: null, reason: "amount -1.617,98"}]} succeeds. This suggests whitespace around inner object fields/separators matters; outer braces alone are not the cause. This is an observation, not a root-cause claim.
Expected / impact
If unquoted keys are supported by SAP, equivalent whitespace variants should retain the same array entries. If this compact form is unsupported or ambiguous, a diagnostic/error would be much safer than silently accepting an empty array.
We encountered this while testing whether compact BAML output reduces model generation tokens in a per-page document extraction pipeline. Silent array loss could remove transactions or citations while the typed call appears successful. We are keeping quoted JSON as the default. All sample data above is synthetic; no private document or model is needed to reproduce.
Source: BoundaryML/baml