Adjusted schema

This commit is contained in:
Clemens 2023-06-23 15:44:27 +02:00
parent 984d4e00ea
commit 061e800437
2 changed files with 9 additions and 10 deletions

View file

@ -33,7 +33,7 @@
(re-matches #"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" input))
(defn uri-vector? [input]
(and (every? #(uri? %) input)
(and (every? #(uri-string? %) input)
(vector? input)))
(def context "@context")
@ -51,8 +51,8 @@
(s/def actor uri-string?)
(s/def object uri-string?)
(s/def ::to uri-string?)
(s/def ::target string?)
(s/def ::to uri-vector?)
(s/def ::object string?)
(s/def ::from uri-string?)
(def like? (s/keys :req-un [context
@ -61,14 +61,13 @@
actor
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 like-data
{:to ["https://chatty.bla/ben/", "https://chatty.bla/gen/"]
:target "https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"
:from "https://social.bla/alyssa/"})
{:object "https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"
:from "https://social.bla/alyssa"})
(defn generate-id-from-object [from]
(str from "out" "/" "sdfsd44243g324g3455"))
@ -77,10 +76,10 @@
[input-map like-data?]
(assoc {}
"@context" activity-streams-context
"id" (str (:from input-map) "#likes/" "RANDOMHASH")
"type" "Like"
"to" (:to input-map)
"actor" (:from input-map)
"object" (:target input-map)))
"object" (:object input-map)))
(defn-spec write-json-ld string?
[input map?

View file

@ -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"}