blob: dd91e47778ec700ac77a0d92ebab0197528a5eda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
(ns weepinbell.metadata.jf2-spec
(:require [clojure.spec.alpha :as s]
[weepinbell.utils.url :refer [valid-http-url?]]))
(s/def ::type string?)
(s/def ::name
(s/or :missing-name nil?
:has-name string?))
(s/def ::url
(s/or :has-value valid-http-url?
:lacks-value nil?))
(s/def ::published
(s/or :date-string string?
:timestamp int?
:no-date nil?))
(s/def ::author
(s/keys :req-un [::type ::name ::url]
:opt-un [::photo]))
(s/def ::content
(s/or :content-map (s/keys :req-un [::text]
:opt-un [::html])
:string string?))
(s/def ::wm-property
#{:like-of :in-reply-to :repost-of :rsvp :mention
"like-of" "in-reply-to" "repost-of" "rsvp" "mention"})
(s/def ::summary
(s/or :has-summary string?
:no-summary nil?))
(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 ::wm-property]
:opt-un [::content ::summary ::like-of ::in-reply-to ::repost-of ::rsvp]))
|