diff --git a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj index a4f8ac3..05ef6df 100644 --- a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj +++ b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj @@ -19,19 +19,23 @@ ; Link Types "Mention"}) +(defn match-type + [type] + #(= (:type %) type)) + (s/def ::Object (s/or :uri core/uri-string? :map (s/and (s/keys :req-un [::id ::type] :opt-un [::attributedTo ::und-mehr]) - #(not (= (:type %) "Link"))))) + #(not (match-type "Link"))))) (s/def ::id core/uri-string?) (s/def ::type #(or (core/uri-string? %) (contains? objectAndLinkTypes %))) (s/def ::Link (s/and (s/keys :req-un [::type] :opt-un [::attributedTo ::und-mehr]) - #(= (:type %) "Link"))) + (match-type "Link"))) (s/def ::Relationship (s/keys :req-un [::object ::und-mehr])) @@ -51,7 +55,6 @@ (s/def ::attributedTo ::Property) (s/def ::actor ::attributedTo) - (s/def ::object ::Property) @@ -69,11 +72,9 @@ (s/def ::verb core/uri-string?) - - - ; #### LIKE #### -(s/def ::Like ::Activity) +(s/def ::Like (s/and ::Activity + (match-type "Like"))) ; Was beim Type Activity optional und required ist, ist abhängig vom Aktivitätstyp. ; Bspw brauch ein Like einen actor und den type "Like" und (xor) target/object.