Skip to content

Instantly share code, notes, and snippets.

@ikitommi
Created April 7, 2014 05:40
Show Gist options
  • Save ikitommi/10015316 to your computer and use it in GitHub Desktop.
Save ikitommi/10015316 to your computer and use it in GitHub Desktop.
peek into a GET*
lein repl
;; nREPL server started on port 50058 on host 127.0.0.1
;; REPL-y 0.3.0
;; Clojure 1.5.1
;; Docs: (doc function-name-here)
;; (find-doc "part-of-name-here")
;; Source: (source function-name-here)
;; Javadoc: (javadoc java-object-or-class-here)
;; Exit: Control+D or (exit) or (quit)
;; Results: Stored in vars *1, *2, *3, an exception in *e
user=> (use 'compojure.api.sweet)
nil
user=> (use 'ring.util.http-response)
nil
user=> (pprint (macroexpand-1 '(GET* "/sum" [] :query-params [x :- Long, y :- Long] (ok {:total (+ x y)}))))
(compojure.core/GET
"/sum"
[:as +compojure-api-request+]
(compojure.api.common/meta-container
{:return nil,
:parameters
[{:type :query,
:model
#<Var@1b0fa62c:
{{:p?
#<core$keyword_QMARK_ clojure.core$keyword_QMARK_@3d5f151f>,
:pred-name keyword?}
{:_ nil},
:y java.lang.Long,
:x java.lang.Long}>}]}
(clojure.core/let
[G__8692
(ring.swagger.schema/coerce!
{schema.core/Keyword schema.core/Any, :y Long, :x Long}
(clojure.walk/keywordize-keys
(:query-params +compojure-api-request+))
:query)]
(plumbing.core/letk
[[x :- Long y :- Long] G__8692]
(ok {:total (+ x y)})))))
nil
user=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment