blob: 6a09b29c1cf60adf0b8e59eeec9580ad242ba4a1 (
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
|
(ns weepinbell.storage.spec
"Spec of storage middle layer, which is a vtable/map of storage functions.
The spec makes sure any map is a valid storage vtable."
(:require [clojure.spec.alpha :as s]
[weepinbell.utils.url :refer [valid-http-url?]]))
;; storage vtable
(s/def ::append fn?)
(s/def ::update fn?)
(s/def ::delete fn?)
(s/def ::get fn?)
(s/def ::get-by-domain fn?)
(s/def ::vtable
(s/keys :req-un [::append ::update ::delete ::get ::get-by-domain]))
;; storage schema
(s/def ::source valid-http-url?)
(s/def ::target valid-http-url?)
(s/def ::id (s/and string?
#(let [len (count %)]
(or (= len 32)
(= len 8)))))
(s/def ::modified int?)
(s/def ::webmention
(s/keys :req-un [::source ::target ::id ::modified]))
(s/def ::jf2
#(s/valid? :weepinbell.metadata.jf2-spec/jf2 %))
(s/def ::proxied-photo valid-http-url?)
(s/def ::extra
(s/keys :opt-un [::proxied-photo]))
(s/def ::webmention-wrapped
(s/keys :req-un [::webmention]
:opt-un [::jf2 ::extra]))
|