 (ns icecap.schema
+  "The schemata in icecap: request specifications and their components."
   (:require [schema.core :as s])
   (:import [java.net URI]))
 

  #{"http" "https"})

(defn get-scheme
  "Gets the scheme of a (String) URL."
  [url]
  (.getScheme (URI. url)))


          (s/pred seq "collection of one or more request specs")))

(def RequestSpec
  "The schema for a request specification.

  Consists either of a `SimpleRequest`, a `RequestSpec` set, or a
  `RequestSpec` vector.

  This uses prismatic/schema's `conditional` with type dispatch,
  rather than the (perhaps more obvious) `either`. If you give it a
  bogus `SimpleRequest`, it will only tell you that it didn't satisfy
  any of the three schemas. It won't tell you that it looked a little
  like a `SimpleRequest`, but had unsupported URL scheme. Using
  `conditional` allows us to return this improved error message.
  "
  (let [RequestSpec (s/recursive #'RequestSpec)]
    (s/conditional
