fixed jspg_schemas returning a drop now

This commit is contained in:
2026-03-16 00:19:32 -04:00
parent 6444b300b3
commit 3bec6a6102
2 changed files with 16 additions and 11 deletions

View File

@ -121,9 +121,10 @@ pub fn jspg_schemas() -> JsonB {
Some(engine) => { Some(engine) => {
let schemas_json = serde_json::to_value(&engine.database.schemas) let schemas_json = serde_json::to_value(&engine.database.schemas)
.unwrap_or(serde_json::Value::Object(serde_json::Map::new())); .unwrap_or(serde_json::Value::Object(serde_json::Map::new()));
JsonB(schemas_json) let drop = crate::drop::Drop::success_with_val(schemas_json);
JsonB(serde_json::to_value(drop).unwrap())
} }
None => JsonB(serde_json::Value::Object(serde_json::Map::new())), None => jspg_failure(),
} }
} }
@ -138,9 +139,10 @@ pub fn jspg_stems() -> JsonB {
Some(engine) => { Some(engine) => {
let stems_json = serde_json::to_value(&engine.database.stems) let stems_json = serde_json::to_value(&engine.database.stems)
.unwrap_or(serde_json::Value::Object(serde_json::Map::new())); .unwrap_or(serde_json::Value::Object(serde_json::Map::new()));
JsonB(stems_json) let drop = crate::drop::Drop::success_with_val(stems_json);
JsonB(serde_json::to_value(drop).unwrap())
} }
None => JsonB(serde_json::Value::Object(serde_json::Map::new())), None => jspg_failure(),
} }
} }

View File

@ -54,13 +54,16 @@ fn test_library_api() {
assert_eq!( assert_eq!(
schemas_drop.0, schemas_drop.0,
json!({ json!({
"test_schema": { "type": "drop",
"$id": "test_schema", "response": {
"type": "object", "test_schema": {
"properties": { "$id": "test_schema",
"name": { "type": "string" } "type": "object",
}, "properties": {
"required": ["name"] "name": { "type": "string" }
},
"required": ["name"]
}
} }
}) })
); );