Fork me on GitHub
#ring-swagger
<
2019-05-21
>
mgrbyte15:05:19

Am trying to figure out the letk syntax for optional body params (but within sweet/resource). Stumbled accross this https://github.com/metosin/compojure-api/issues/154 and found the docs - but can't find an example of destructuring :body-params in the resource case, anyone know if it's possible?

ikitommi16:05:34

@mgrbyte resource is all data, so the fnk can only be used in destructuring, not in declaring parameters. So, you need to declare the optionality via :parameters. Example here: https://github.com/metosin/compojure-api/blob/master/test/compojure/api/resource_test.clj#L43-L47

mgrbyte09:05:34

Thanks @U055NJ5CC - i had seen this, but looks like it's for schema not spec (can't find an/figure out the equivalent spec example)