Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/cognitect/aws/shape.clj
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@

(defmethod json-serialize* "structure"
[shapes shape data]
(when data
(cond
(:document shape)
data

data
(reduce-kv (fn [m k v]
(if-let [member-shape (resolve shapes (structure-member-shape-ref shape k))]
(assoc m
Expand Down
6 changes: 6 additions & 0 deletions test/src/cognitect/aws/shape_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@
(shape/json-parse* {}
{:type "structure" :document true}
[{:this "is" :a "doc"}])))))

(deftest test-json-serialize
(is (= "{\"this\":\"is\",\"a\":\"doc\"}"
(shape/json-serialize {}
{:type "structure", :members {}, :document true}
{:this "is" :a "doc"}))))