Skip to content

Commit

Permalink
AS: fix flatten function
Browse files Browse the repository at this point in the history
Before this commit, the parsed claims of arrays will be flatten into a
nested structure like map. But in real scenario like AAEL, Array will
only be the "leaf" member of the parsed claims. Thus keep it as-is is
better.

Signed-off-by: Xynnn007 <[email protected]>
  • Loading branch information
Xynnn007 committed Jul 15, 2024
1 parent 9a02b0b commit 3be47a1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions attestation-service/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ fn flatten_helper(parent: &mut Map<String, Value>, child: &serde_json::Value, pr
let _ = parent.insert(prefix, Value::String(str.clone()));
}
Value::Array(arr) => {
for (i, v) in arr.iter().enumerate() {
let sub_prefix = format!("{prefix}.{i}");
flatten_helper(parent, v, sub_prefix);
}
let _ = parent.insert(prefix, Value::Array(arr.clone()));
}
Value::Object(obj) => {
for (k, v) in obj {
Expand Down

0 comments on commit 3be47a1

Please sign in to comment.