-
Notifications
You must be signed in to change notification settings - Fork 1
/
spec.cljc
32 lines (26 loc) · 1001 Bytes
/
spec.cljc
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
(ns com.yetanalytics.persephone.utils.spec
"Profile-specific Statement specs (as opposed to the general specs
of xapi-schema)."
(:require [clojure.spec.alpha :as s]
[clojure.walk :as w]
[xapi-schema.spec :as xs]))
;; Currently unused in production code, but may be useful for testing.
(s/def ::profile ::xs/iri)
(s/def ::subregistration ::xs/uuid)
(def subreg-ext-obj-spec
"Spec for a single subregistration object."
(s/keys :req-un [::profile ::subregistration]))
(def subreg-ext-spec*
"Spec for the subregistration extension value, a vector of
subregistration objects."
(s/coll-of subreg-ext-obj-spec :kind vector? :min-count 1))
(def subreg-ext-spec
"Same as `subreg-ext-spec*` but expects string keys."
(s/and (s/conformer w/keywordize-keys w/stringify-keys)
subreg-ext-spec*))
(defn lazy-seq?
"Is `s` a lazy sequence?"
[s]
(instance? #?(:clj clojure.lang.LazySeq
:cljs cljs.core/LazySeq)
s))