Fork me on GitHub
#ring-swagger
<
2016-10-26
>
tap04:10:54

For compojure-api, as far as I know, there’s no way to specify optional parameter for *-params form. Is is correct? In the below code snippet, if I want to add an optional parameter, I’ll have to switch from :query-params to :query, right?

(GET "/endpoint" []
  :query-params [param1 :- s/Str]
  (ok {:some :result}))

ikitommi10:10:02

@tap, you need to provide a default value to make it optional: :query-params [{param1 :- s/Str ""}].

tap10:10:34

@ikitommi Got it, thanks.

ikitommi10:10:23

np. There should be a tutorial for c-api. Any volunteers? ;)

tap10:10:51

If you mean this particular issue, I can find somewhere to put an example in. Probably to README or wiki