fix: correct tests following strict removal of legacy json aliases

This commit is contained in:
Riz Ashraf committed 2026-10-10 08:24:42 +01:00
1 parent a9ed5ae9c8
commit 8ff43487bc
5 files changed
+4 -10

No files matched your search

+1 -2
View File
@@ -1369,10 +1369,9 @@ mod tests {
.unwrap(); .unwrap();
assert!(res.contains("Successfully created 1 relation(s)")); assert!(res.contains("Successfully created 1 relation(s)"));
// Test serde field aliases (source/target/relationType mapped to from/to/relation_type)
let alias_args = json!({ let alias_args = json!({
"relations": [ "relations": [
{"source": "A", "target": "B", "relationType": "knows"} {"from": "A", "to": "B", "relation_type": "knows"}
] ]
}); });
let alias_res = handler.execute(alias_args, state.clone()).await.unwrap(); let alias_res = handler.execute(alias_args, state.clone()).await.unwrap();
+2 -2
View File
@@ -1900,7 +1900,7 @@ mod tests {
"title": "Architecture", "title": "Architecture",
"context": "Needs DB", "context": "Needs DB",
"decision": "Use SQLite", "decision": "Use SQLite",
"consequence": "Simple", "consequences": "Simple",
}); });
let res1 = decision_handler let res1 = decision_handler
.execute(args_dec, state.clone()) .execute(args_dec, state.clone())
@@ -2112,7 +2112,7 @@ mod tests {
"title": "Use Axum", "title": "Use Axum",
"context": "Architecture choice", "context": "Architecture choice",
"decision": "Adopt Axum for web framework", "decision": "Adopt Axum for web framework",
"consequence": "Fast async API routing" "consequences": "Fast async API routing"
}), }),
state.clone(), state.clone(),
) )
-5
View File
@@ -185,7 +185,6 @@ impl std::fmt::Display for TaskStatus {
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)]
pub struct Entity { pub struct Entity {
pub name: String, pub name: String,
#[serde(alias = "entityType", alias = "type", alias = "category")]
pub entity_type: String, pub entity_type: String,
#[serde(default)] #[serde(default)]
pub observations: Vec<String>, pub observations: Vec<String>,
@@ -207,11 +206,8 @@ pub struct Entity {
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)] #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)]
pub struct Relation { pub struct Relation {
#[serde(alias = "source", alias = "from_node", alias = "source_node")]
pub from: String, pub from: String,
#[serde(alias = "target", alias = "to_node", alias = "target_node")]
pub to: String, pub to: String,
#[serde(alias = "relationType", alias = "type", alias = "relation")]
pub relation_type: String, pub relation_type: String,
#[serde(default = "default_namespace")] #[serde(default = "default_namespace")]
pub namespace: String, pub namespace: String,
@@ -363,7 +359,6 @@ pub struct Adr {
pub title: String, pub title: String,
pub context: String, pub context: String,
pub decision: String, pub decision: String,
#[serde(alias = "consequences")]
pub consequence: String, pub consequence: String,
#[serde(default = "default_adr_status")] #[serde(default = "default_adr_status")]
pub status: String, pub status: String,
+1 -1
View File
@@ -9,7 +9,7 @@ pub struct CreateEntitiesTool {
} }
/// Create new relations between entities in the knowledge graph. /// Create new relations between entities in the knowledge graph.
/// Create new relations between entities in the knowledge graph (accepts 'from' or 'source', 'to' or 'target', and 'relation_type' or 'type'). /// Create new relations between entities in the knowledge graph.
#[derive(Debug, Deserialize, Serialize, JsonSchema)] #[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct CreateRelationsTool { pub struct CreateRelationsTool {
/// Array of relations to create. Each relation item MUST use 'from', 'to', and 'relation_type'. /// Array of relations to create. Each relation item MUST use 'from', 'to', and 'relation_type'.
View File
Whitespace-only changes.