Fork me on GitHub

@ikitommi I found the diff and it appeared that I am using nginx-clojure embed webserver and in this case the schema validation became broken, try: create new proj: lein new compojure-api c2 replace project.clj with

(defproject c2 "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [metosin/compojure-api "1.1.10"]]
  :ring {:handler c2.handler/app}
  :uberjar-name "server.jar"
  :profiles {:dev {:dependencies [[javax.servlet/javax.servlet-api "3.1.0"]
                                  [nginx-clojure/nginx-clojure-embed "0.4.5"]]
                   :main c2.handler
                   :plugins [[lein-ring "0.10.0"]]}})

replace handler.clj with
(ns c2.handler
  (:require [compojure.api.sweet :refer :all]
            [ring.util.http-response :refer :all]
            [schema.core :as s]
            [nginx.clojure.embed :as embed]))

(s/defschema Collection
  {:id s/Int
   :name s/Str})

(s/defschema Tag
  {:id s/Int
   :tag s/Str})

(def app
    (context "/:storeId" []
      (GET "/collections" {:as request params :params}
        :summary "Get Collections"
        :path-params [storeId :- s/Str]
        :return [Collection]
        (ok [{:id 101 :name "My Collection"}]))

      (GET "/tags" {:as request params :params}
        :summary "Get Tags"
        :path-params [storeId :- s/Str]
        :return [Tag]
        (ok [{:id 101 :tag "My Collection"}])))))

(defn start-server
  "Run an emebed nginx-clojure for debug/test usage."
  [dev? port]
  (embed/run-server app {:port port}))

(defn -main
  [& args]
  (let [dev? (empty? args)
        port (or (first args) 8080)
        port (start-server dev? port)]
    (when-not (System/getProperty "java.awt.headless")
        (.browse (java.awt.Desktop/getDesktop) ( (str "" port "/")))
        (catch java.awt.HeadlessException _)))))

Now if you run it with lein with-profile dev run You can reproduce my error


@serg thanks for the detailed raport. Will check that out. Almost back from the lakeside & holidays, will have more time soon.


@plins if I understood correctly, it still fails? Could you provide a minimalistic non-working sample project, would help to dig in.