From 69d93a99ff1949fe1a47eae0f97ff88db6c373e0 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Wed, 2 Aug 2023 12:03:12 +0200 Subject: [PATCH] add the option for having [value] or value --- .../activity_pub_poc/activitystreams2.cljc | 46 +++++++++++-------- .../activity_pub_poc/spec_helper.cljc | 8 ++++ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc index b3554bc..6c92dd7 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc @@ -51,66 +51,72 @@ (s/and ::owl/ObjectProperty ::owl/Class - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) ;http://www.w3.org/ns/activitystreams#id (s/def ::id (s/and ::owl/DatatypeProperty ::owl/FunctionalProperty ::owl/DeprecatedProperty - ::xsd/anyURI)) + (sh/seq-spec ::xsd/anyURI))) ;http://www.w3.org/ns/activitystreams#bcc (s/def ::bcc (s/and ::owl/ObjectProperty - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) ;http://www.w3.org/ns/activitystreams#bto (s/def ::bto (s/and ::owl/ObjectProperty - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) ;http://www.w3.org/ns/activitystreams#cc (s/def ::cc (s/and ::owl/ObjectProperty - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) ;http://www.w3.org/ns/activitystreams#to (s/def ::to (s/and ::owl/ObjectProperty - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) ;https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type ;TODO: this can not be found in the ttl / namespace. Where is this exactly defined? (s/def ::type - (s/or - :single-value ::xsd/anyURI - :coll-of-values (s/+ ::xsd/anyURI))) + (sh/seq-spec ::xsd/anyURI)) ;http://www.w3.org/ns/activitystreams#result (s/def ::result (s/and ::owl/ObjectProperty - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) ;http://www.w3.org/ns/activitystreams#object (s/def ::object (s/and ::owl/ObjectProperty ::owl/Class - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) ;http://www.w3.org/ns/activitystreams#actor (s/def ::actor (s/and ::owl/ObjectProperty ::owl/Class - ::Object - ::Link)) + (sh/seq-spec (s/and + ::Object + ::Link)))) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc index c4393fa..da44614 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc @@ -13,6 +13,14 @@ :no-map #(not (map? %)) :map spec))) +(defn-spec seq-spec s/spec? + "Spec that applies only for map values." + [spec s/spec?] + (s/and + (s/or + :single-value spec + :coll-of-values (s/+ spec)))) + (defn-spec is-functional-property? boolean? "Checks whether spec is a FunctionalProperty."