Fix JSON Schema definitions path used for debug task (#33873)

Regression in #33678

Release Notes:

- (Preview Only) Fixed invalid json schema for `debug.json`.
This commit is contained in:
Michael Sloan 2025-07-03 15:04:33 -06:00 committed by GitHub
parent fcd9da6cef
commit 7a2593e520
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -301,7 +301,12 @@ impl DebugTaskFile {
.get_mut("properties") .get_mut("properties")
.and_then(|value| value.as_object_mut()) .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 if let Some(arr) = template_object
@ -311,13 +316,13 @@ impl DebugTaskFile {
arr.retain(|v| v.as_str() != Some("label")); arr.retain(|v| v.as_str() != Some("label"));
} }
} else { } 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 let task_definitions = build_task_value.get("$defs").cloned().unwrap_or_default();
.get("definitions")
.cloned()
.unwrap_or_default();
let adapter_conditions = schemas let adapter_conditions = schemas
.0 .0
@ -375,7 +380,7 @@ impl DebugTaskFile {
}, },
"allOf": adapter_conditions "allOf": adapter_conditions
}, },
"definitions": task_definitions "$defs": task_definitions
}) })
} }
} }