summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-10-30 11:20:33 +0800
committereltrac <hi@eltr.ac>2026-10-30 11:20:33 +0800
commitbccd5b715ba24a483270536d64826f8bac13d08f (patch)
tree506bb78c5f73571f6804faae3fd45571155cc55c
parent133775848c6b33e5716032326c6f5956aa3174c0 (diff)
jf2/spec: allow missing name; wm-properties are arrays; rsvp is string not URL
-rw-r--r--src/weepinbell/metadata/jf2_spec.clj24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/weepinbell/metadata/jf2_spec.clj b/src/weepinbell/metadata/jf2_spec.clj
index f179244..dd91e47 100644
--- a/src/weepinbell/metadata/jf2_spec.clj
+++ b/src/weepinbell/metadata/jf2_spec.clj
@@ -4,7 +4,9 @@
(s/def ::type string?)
-(s/def ::name string?)
+(s/def ::name
+ (s/or :missing-name nil?
+ :has-name string?))
(s/def ::url
(s/or :has-value valid-http-url?
@@ -20,7 +22,8 @@
:opt-un [::photo]))
(s/def ::content
- (s/or :content-map (s/keys :req-un [::html ::text])
+ (s/or :content-map (s/keys :req-un [::text]
+ :opt-un [::html])
:string string?))
(s/def ::wm-property
@@ -31,12 +34,17 @@
(s/or :has-summary string?
:no-summary nil?))
-(s/def ::like-of valid-http-url?)
-(s/def ::in-reply-to valid-http-url?)
-(s/def ::repost-of valid-http-url?)
-(s/def ::rsvp valid-http-url?)
+(s/def ::like-of
+ (s/and sequential? #(every? valid-http-url? %)))
+(s/def ::in-reply-to
+ (s/and sequential? #(every? valid-http-url? %)))
+(s/def ::repost-of
+ (s/and sequential? #(every? valid-http-url? %)))
+(s/def ::rsvp
+ (s/or :single-answer string?
+ :multi-answer #(every? string? %)))
(s/def ::jf2
- (s/keys :req-un [::type ::name ::url ::author ::published ::content ::wm-property]
- :opt-un [::summary ::like-of ::in-reply-to ::repost-of ::rsvp]))
+ (s/keys :req-un [::type ::name ::url ::author ::published ::wm-property]
+ :opt-un [::content ::summary ::like-of ::in-reply-to ::repost-of ::rsvp]))