From 14945e02d874a5007e8e0f50b52e40214fa05ccc Mon Sep 17 00:00:00 2001 From: Bharath Selvaraj Date: Wed, 28 May 2025 07:39:17 -0400 Subject: [PATCH 1/2] Removed extra backslash when generating namespaces. Caused an issues of too many backslashes resulting in invalid uri's --- .gitignore | 1 + src/lib.rs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ea8c4bf..eed3cc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +*.txt diff --git a/src/lib.rs b/src/lib.rs index ecae84c..9934310 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -155,6 +155,13 @@ fn process_value( graph: &mut Graph, namespace: &String, ) { + + let ns = if namespace.ends_with("/") { + namespace + } else { + &([namespace, "/"].join("")) + }; + if let Some(last_subject) = subject_stack.clone().back() { if let Some(prop) = property { match value { @@ -204,14 +211,14 @@ fn process_value( for (key, val) in obj { let nested_property: Option = - Some(format!("{}/{}", namespace, key)); - process_value(subject_stack, &nested_property, val, graph, namespace); + Some(format!("{}{}", ns, key)); + process_value(subject_stack, &nested_property, val, graph, ns); } subject_stack.pop_back(); } Value::Array(arr) => { for val in arr { - process_value(subject_stack, property, val, graph, namespace); + process_value(subject_stack, property, val, graph, ns); } } } From 224b4143e3c0183c18206fb0f73a77e28554dbfc Mon Sep 17 00:00:00 2001 From: Bharath Selvaraj Date: Wed, 28 May 2025 07:40:33 -0400 Subject: [PATCH 2/2] Fixing format due to Rustfmt check failing --- src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9934310..63c3dfc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -155,7 +155,6 @@ fn process_value( graph: &mut Graph, namespace: &String, ) { - let ns = if namespace.ends_with("/") { namespace } else { @@ -210,8 +209,7 @@ fn process_value( )); for (key, val) in obj { - let nested_property: Option = - Some(format!("{}{}", ns, key)); + let nested_property: Option = Some(format!("{}{}", ns, key)); process_value(subject_stack, &nested_property, val, graph, ns); } subject_stack.pop_back();