From 44a35adb9569bd63e35e030f1c6842ec7fbc4c49 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 24 Aug 2026 22:55:07 +0200 Subject: [PATCH] Close empty strategic array schemas --- crates/ghostlight-dungeon/src/persona.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/ghostlight-dungeon/src/persona.rs b/crates/ghostlight-dungeon/src/persona.rs index 13c6fb2..0a31337 100644 --- a/crates/ghostlight-dungeon/src/persona.rs +++ b/crates/ghostlight-dungeon/src/persona.rs @@ -2670,7 +2670,12 @@ fn exact_string_array_schema( max_items: usize, ) -> serde_json::Value { if values.is_empty() { - serde_json::json!({"type":"array","minItems":min_items,"maxItems":0}) + serde_json::json!({ + "type":"array", + "minItems":min_items, + "maxItems":0, + "items":{"type":"string"} + }) } else { serde_json::json!({ "type":"array", @@ -3411,6 +3416,16 @@ mod tests { assert!(validator.is_valid(&appraisal)); } + #[test] + fn exact_empty_string_arrays_remain_valid_strict_response_schemas() { + let schema = exact_string_array_schema(&BTreeSet::new(), 0, 8); + assert_eq!(schema["maxItems"], 0); + assert_eq!(schema["items"]["type"], "string"); + assert!(jsonschema::validator_for(&schema) + .unwrap() + .is_valid(&serde_json::json!([]))); + } + #[test] fn effect_verifier_binding_changes_with_the_exact_action_bundle() { let first = crate::domain::CellActionProposal {