fixed jspg_schemas returning a drop now
This commit is contained in:
10
src/lib.rs
10
src/lib.rs
@ -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(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,8 @@ fn test_library_api() {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
schemas_drop.0,
|
schemas_drop.0,
|
||||||
json!({
|
json!({
|
||||||
|
"type": "drop",
|
||||||
|
"response": {
|
||||||
"test_schema": {
|
"test_schema": {
|
||||||
"$id": "test_schema",
|
"$id": "test_schema",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@ -62,6 +64,7 @@ fn test_library_api() {
|
|||||||
},
|
},
|
||||||
"required": ["name"]
|
"required": ["name"]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user