metosin / compojure-api

Sweet web apis with Compojure & Swagger
http://metosin.github.io/compojure-api/doc/
Eclipse Public License 1.0
1.12k stars 149 forks source link

Spec coercion won't compile when using path-params or query-params #387

Closed vehvis closed 6 years ago

vehvis commented 6 years ago

Library Version(s)

compojure-api 2.0.0-alpha21 clojure 1.9.0

Problem

Spec coercion causes CompilerException (qualified-keyword? n) when defining path-params or query-params using the "traditional" API style.

This is condensed from the relevant compojure-api example:

(require '[clojure.spec.alpha :as s])
(require '[spec-tools.spec :as spec])
(require '[compojure.api.sweet :refer :all])
(require '[ring.util.http-response :refer :all])

(def app
  (api
    {:coercion :spec}

    (context "/math/:a" []
      :path-params [a :- int?]

      (POST "/plus" []
        :query-params [b :- int?]
        (ok)))))
vehvis commented 6 years ago

Sorry, got an old spec-tools version. With 0.7.1 everything works. Closing this issue.