Clean up JSON schema test messages

This commit is contained in:
Piotr Siuszko 2025-06-21 21:50:23 +02:00
parent 0a3b70762c
commit f2fd5707f0

View File

@ -418,6 +418,10 @@ mod tests {
else { else {
panic!("Failed to export JSON schema for Foo"); panic!("Failed to export JSON schema for Foo");
}; };
eprintln!(
"{}",
serde_json::to_string_pretty(&schema).expect("Failed to serialize schema")
);
schema schema
} }
@ -432,7 +436,6 @@ mod tests {
} }
let schema = export_type::<Foo>(); let schema = export_type::<Foo>();
eprintln!("{}", serde_json::to_string_pretty(&schema).expect("msg"));
assert!( assert!(
!schema.reflect_types.contains(&"Component".to_owned()), !schema.reflect_types.contains(&"Component".to_owned()),
"Should not be a component" "Should not be a component"
@ -463,7 +466,6 @@ mod tests {
NoValue, NoValue,
} }
let schema = export_type::<EnumComponent>(); let schema = export_type::<EnumComponent>();
eprintln!("{}", serde_json::to_string_pretty(&schema).expect("msg"));
assert!( assert!(
schema.reflect_types.contains(&"Component".to_owned()), schema.reflect_types.contains(&"Component".to_owned()),
"Should be a component" "Should be a component"
@ -533,7 +535,7 @@ mod tests {
let type_registry = atr.read(); let type_registry = atr.read();
let schema = type_registry let schema = type_registry
.export_type_json_schema::<EnumComponent>(&metadata) .export_type_json_schema::<EnumComponent>(&metadata)
.expect("Failed to export"); .expect("Failed to export schema");
assert!( assert!(
!metadata.has_type_data::<ReflectComponent>(&schema.reflect_types), !metadata.has_type_data::<ReflectComponent>(&schema.reflect_types),
"Should not be a component" "Should not be a component"
@ -582,7 +584,7 @@ mod tests {
let type_registry = atr.read(); let type_registry = atr.read();
let schema = type_registry let schema = type_registry
.export_type_json_schema::<SomeType>(&SchemaTypesMetadata::default()) .export_type_json_schema::<SomeType>(&SchemaTypesMetadata::default())
.expect("Failed to export"); .expect("Failed to export schema");
assert!( assert!(
!schema.reflect_types.contains(&"Component".to_owned()), !schema.reflect_types.contains(&"Component".to_owned()),
"Should not be a component" "Should not be a component"
@ -625,8 +627,7 @@ mod tests {
} }
let schema = export_type::<Foo>(); let schema = export_type::<Foo>();
let schema_as_value = serde_json::to_value(&schema).expect("Should serialize"); let schema_as_value = serde_json::to_value(&schema).expect("Failed to serialize schema");
eprintln!("{:#?}", &schema_as_value);
let value = json!({ let value = json!({
"shortPath": "Foo", "shortPath": "Foo",
"$schema": "https://json-schema.org/draft/2020-12/schema", "$schema": "https://json-schema.org/draft/2020-12/schema",
@ -652,7 +653,6 @@ mod tests {
"description": "Test doc", "description": "Test doc",
"shortPath": "u16", "shortPath": "u16",
"typePath": "u16", "typePath": "u16",
}, },
}, },
"required": [ "required": [