Adjusted schema
This commit is contained in:
parent
984d4e00ea
commit
061e800437
2 changed files with 9 additions and 10 deletions
|
@ -33,7 +33,7 @@
|
||||||
(re-matches #"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" input))
|
(re-matches #"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" input))
|
||||||
|
|
||||||
(defn uri-vector? [input]
|
(defn uri-vector? [input]
|
||||||
(and (every? #(uri? %) input)
|
(and (every? #(uri-string? %) input)
|
||||||
(vector? input)))
|
(vector? input)))
|
||||||
|
|
||||||
(def context "@context")
|
(def context "@context")
|
||||||
|
@ -51,8 +51,8 @@
|
||||||
(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-vector?)
|
||||||
(s/def ::target string?)
|
(s/def ::object string?)
|
||||||
(s/def ::from uri-string?)
|
(s/def ::from uri-string?)
|
||||||
|
|
||||||
(def like? (s/keys :req-un [context
|
(def like? (s/keys :req-un [context
|
||||||
|
@ -61,14 +61,13 @@
|
||||||
actor
|
actor
|
||||||
object]))
|
object]))
|
||||||
|
|
||||||
(def like-data? (s/keys :req-un [::to ::target ::from]))
|
(def like-data? (s/keys :req-un [::to ::object ::from]))
|
||||||
|
|
||||||
(def activity-streams-context "https://www.w3.org/ns/activitystreams")
|
(def activity-streams-context "https://www.w3.org/ns/activitystreams")
|
||||||
|
|
||||||
(def like-data
|
(def like-data
|
||||||
{:to ["https://chatty.bla/ben/", "https://chatty.bla/gen/"]
|
{:object "https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"
|
||||||
:target "https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"
|
:from "https://social.bla/alyssa"})
|
||||||
:from "https://social.bla/alyssa/"})
|
|
||||||
|
|
||||||
(defn generate-id-from-object [from]
|
(defn generate-id-from-object [from]
|
||||||
(str from "out" "/" "sdfsd44243g324g3455"))
|
(str from "out" "/" "sdfsd44243g324g3455"))
|
||||||
|
@ -77,10 +76,10 @@
|
||||||
[input-map like-data?]
|
[input-map like-data?]
|
||||||
(assoc {}
|
(assoc {}
|
||||||
"@context" activity-streams-context
|
"@context" activity-streams-context
|
||||||
|
"id" (str (:from input-map) "#likes/" "RANDOMHASH")
|
||||||
"type" "Like"
|
"type" "Like"
|
||||||
"to" (:to input-map)
|
|
||||||
"actor" (:from input-map)
|
"actor" (:from input-map)
|
||||||
"object" (:target input-map)))
|
"object" (:object input-map)))
|
||||||
|
|
||||||
(defn-spec write-json-ld string?
|
(defn-spec write-json-ld string?
|
||||||
[input map?
|
[input map?
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"@context":"https://www.w3.org/ns/activitystreams","type":"Like","to":["https://chatty.bla/ben/","https://chatty.bla/gen/"],"actor":"https://social.bla/alyssa/","object":"https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"}
|
{"@context":"https://www.w3.org/ns/activitystreams","id":"https://social.bla/alyssa#likes/RANDOMHASH","type":"Like","to":["https://chatty.bla/ben","https://chatty.bla/gen"],"actor":"https://social.bla/alyssa","object":"https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"}
|
Loading…
Reference in a new issue