From 7a2593e5206fd8fe15be34cc8c195d3aa8ba97d1 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Thu, 3 Jul 2025 15:04:33 -0600 Subject: [PATCH] Fix JSON Schema definitions path used for debug task (#33873) Regression in #33678 Release Notes: - (Preview Only) Fixed invalid json schema for `debug.json`. --- crates/task/src/debug_format.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/crates/task/src/debug_format.rs b/crates/task/src/debug_format.rs index f95fcf56b6..2d24098bbb 100644 --- a/crates/task/src/debug_format.rs +++ b/crates/task/src/debug_format.rs @@ -301,7 +301,12 @@ impl DebugTaskFile { .get_mut("properties") .and_then(|value| value.as_object_mut()) { - properties.remove("label"); + if properties.remove("label").is_none() { + debug_panic!( + "Generated TaskTemplate json schema did not have expected 'label' field. \ + Schema of 2nd alternative is: {template_object:?}" + ); + } } if let Some(arr) = template_object @@ -311,13 +316,13 @@ impl DebugTaskFile { arr.retain(|v| v.as_str() != Some("label")); } } else { - debug_panic!("Task Template schema in debug scenario's needs to be updated"); + debug_panic!( + "Generated TaskTemplate json schema did not match expectations. \ + Schema is: {build_task_value:?}" + ); } - let task_definitions = build_task_value - .get("definitions") - .cloned() - .unwrap_or_default(); + let task_definitions = build_task_value.get("$defs").cloned().unwrap_or_default(); let adapter_conditions = schemas .0 @@ -375,7 +380,7 @@ impl DebugTaskFile { }, "allOf": adapter_conditions }, - "definitions": task_definitions + "$defs": task_definitions }) } }