WIP write json

This commit is contained in:
erik 2023-06-23 13:11:31 +02:00
parent e0e5bc666f
commit 804250ed85

View file

@ -5,6 +5,7 @@
[org.domaindrivenarchitecture.activity-pub-poc.common :as cm] [org.domaindrivenarchitecture.activity-pub-poc.common :as cm]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[orchestra.core :refer [defn-spec]] [orchestra.core :refer [defn-spec]]
[clojure.data.json :as json]
[clojure.inspector :as ins] [clojure.inspector :as ins]
[hato.client :as hato] [hato.client :as hato]
[clojure.string :as st] [clojure.string :as st]
@ -49,6 +50,7 @@
(s/def to-uri uri-vector?) (s/def to-uri uri-vector?)
(s/def actor uri-string?) (s/def actor uri-string?)
(s/def object uri-string?) (s/def object uri-string?)
(s/def ::to uri-string?) (s/def ::to uri-string?)
(s/def ::target string?) (s/def ::target string?)
(s/def ::from uri-string?) (s/def ::from uri-string?)
@ -82,6 +84,13 @@
"actor" (:from input-map) "actor" (:from input-map)
"object" (:target input-map))) "object" (:target input-map)))
(defn-spec write-json-ld string?
[input map?
filename string?]
(->
input
(json/write-str)
(#(spit filename %))))