Fork me on GitHub
#reitit
<
2018-11-16
>
Heikki Hämäläinen11:11:07

If using Reitit with spec - is there possibility to coerce with default value? Example -> I have a body parameter as :foo which can be either “bar” “baz” “bat” but if it missing defaults to “bar”?

ikitommi11:11:02

@heikki.hamalainen I don't think there is anything for defaults in spec currently. We just added support for default with Schema (https://github.com/metosin/schema-tools/blob/master/CHANGES.md#0105-2018-11-01), so I think it's doable for spec too.

ikitommi11:11:34

for data-specs, it would be easy already, for vanilla specs, not so. The core team is doing spec-alpha2 atm, watching the repo, not sure will the keys specs change to support this kind of things.

Heikki Hämäläinen11:11:26

Ok, this could be good addition in the future. Reitit is very good alternative to compojure-api so hopefully sometime this is available 🙂