Skip to content

Commit

Permalink
s/def
Browse files Browse the repository at this point in the history
  • Loading branch information
1e16miin committed Nov 1, 2024
1 parent 78e3ae5 commit f302994
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/com/walmartlabs/lacinia/parser/schema.clj
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@
(s/def ::fn-map (s/map-of simple-keyword? ::field-fn))
(s/def ::parse ::schema/parse-or-serialize-fn)
(s/def ::serialize ::schema/parse-or-serialize-fn)
(s/def ::specified-by string?)
(s/def ::scalar-def (s/keys :req-un [::parse ::serialize]
:opt-un [::description ::specified-by]))
(s/def ::description string?)
Expand Down
15 changes: 12 additions & 3 deletions src/com/walmartlabs/lacinia/schema.clj
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
[clojure.pprint :as pprint]
[com.walmartlabs.lacinia.selection :as selection])
(:import
(clojure.lang IObj PersistentQueue)
(java.io Writer)
(java.util.concurrent Executor ThreadPoolExecutor TimeUnit LinkedBlockingQueue ThreadFactory)))
(java.net URL)
(clojure.lang IObj PersistentQueue)
(java.io Writer)
(java.util.concurrent Executor ThreadPoolExecutor TimeUnit LinkedBlockingQueue ThreadFactory)))

;; When using Clojure 1.8, the dependency on clojure-future-spec must be included,
;; and this code will trigger
Expand Down Expand Up @@ -289,6 +290,13 @@
([message data]
(merge {:message message} data)))

(defn url?
[url]
(try
(URL. url)
true
(catch Exception _ false)))

;;-------------------------------------------------------------------------------
;; ## Validations

Expand Down Expand Up @@ -397,6 +405,7 @@
:var var?))
(s/def ::parse ::parse-or-serialize-fn)
(s/def ::serialize ::parse-or-serialize-fn)
(s/def ::specified-by url?)
(s/def ::scalar (s/keys :opt-un [::description
::directives
::specified-by]
Expand Down

0 comments on commit f302994

Please sign in to comment.