Created
March 13, 2015 04:02
-
-
Save anonymous/a96e87b9cfe663e45373 to your computer and use it in GitHub Desktop.
compilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns api.errors | |
(:require [ring.util.http-response :refer :all] | |
[compojure.api.sweet :refer :all] | |
[schema.core :as s] | |
[ring.swagger.schema :refer [describe coerce]]) | |
(:import (org.joda.time LocalDate))) | |
(def error-responses { 400 ^{:message "message1"} Exception | |
404 ^{:message "message2"} Exception | |
500 ^{:message "message3"} Exception | |
501 ^{:message "message4"} Exception | |
503 ^{:message "message5"} Exception }) | |
;; Fails w/ compilerException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, | |
(defroutes* bad-example | |
(GET* "/bad-example/:id" [] | |
:path-params [id :- (describe s/Int "ID ex. 1392302")] | |
:responses error-responses | |
(ok id))) | |
;; Succeeds to create correct documentation | |
(defroutes* good-example | |
(GET* "/good-example/:id" [] | |
:path-params [id :- (describe s/Int "ID ex. 1392302")] | |
:responses { 400 ^{:message "message1"} Exception | |
404 ^{:message "message2"} Exception | |
500 ^{:message "message3"} Exception | |
501 ^{:message "message4"} Exception | |
503 ^{:message "message5"} Exception } | |
(ok id))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment