Skip to content

Commit

Permalink
Update entity JSON parsing for changes to entity struct (#544)
Browse files Browse the repository at this point in the history
Signed-off-by: John Kastner <jkastner@amazon.com>
  • Loading branch information
john-h-kastner-aws authored Feb 17, 2025
1 parent 77e44e8 commit d60ba77
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cedar-lean/DiffTest/Parser.lean
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ def jsonToRequest (json : Lean.Json) : ParseResult Request := do


def jsonToEntityData (json : Lean.Json) : ParseResult EntityData := do
let ancestorsArr ← getJsonField json "ancestors" >>= jsonToArray
let ancestors ← List.mapM jsonToEuid ancestorsArr.toList
let parentsArr ← getJsonField json "parents" >>= jsonToArray
let indirectAncestorsArr ← getJsonField json "indirect_ancestors" >>= jsonToArray
let ancestors ← List.mapM jsonToEuid (parentsArr.toList ++ indirectAncestorsArr.toList)
let attrsKVs ← getJsonField json "attrs" >>= jsonObjToKVList
let attrs ← mapMValues attrsKVs jsonToValue
let tagsKVs ← -- the "tags" field may be absent
Expand Down

0 comments on commit d60ba77

Please sign in to comment.