Skip to content

Commit f80c383

Browse files
committed
Fix cson serialization for fully qualified tagged literals
1 parent a42b2c7 commit f80c383

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/portal/runtime/cson.cljc

+6-3
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,14 @@
754754
:cljr clojure.lang.TaggedLiteral
755755
:cljs TaggedLiteral)
756756
ToJson
757-
(-to-json [value buffer]
757+
(-to-json [{:keys [tag form]} buffer]
758758
(-> buffer
759759
(json/push-string "tag")
760-
(json/push-string (name (:tag value)))
761-
(to-json (:form value)))))
760+
(json/push-string
761+
(if-let [ns (namespace tag)]
762+
(str ns "/" (name tag))
763+
(name tag)))
764+
(to-json form))))
762765

763766
(defn- ->tagged-literal [buffer]
764767
(tagged-literal (symbol (json/next-string buffer)) (->value buffer)))

test/portal/runtime/cson_test.cljc

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@
131131
#?(:clj (UUID/randomUUID)
132132
:cljr (Guid/NewGuid)
133133
:cljs (random-uuid))
134-
(tagged-literal 'tag :value)])
134+
(tagged-literal 'tag :value)
135+
(tagged-literal 'ns/tag :value)])
135136

136137
(deftest tagged-objects
137138
(doseq [value tagged]

0 commit comments

Comments
 (0)