Hi π:skin-tone-2: can reitit validate parameter values specified by spec or malli? Is it possible to tell that the parameter should be int and also between values x and y? Or is this something that the handler needs to take care of? I know it can coerce the parameter to the type int but how about the later part π
hi. sure you can, for example with malli you can say [:int {:min 1, :max 100}]
.
or [:and :int [:fn (fn [x] (>= 1 x 100)]]
with spec i recall itβs: (s/int-in 1 100)
That worked beautifully! This reduces the amount of boilerplate code I need to write π
My mistake was that I tried to use the validation like I saw it in the examples in Malli repo: {:path [:map [:quiz [:and int? [:> 6]]] [:option int?]]}
. I think it worked somehow but the output error wasnβt so beautiful:
...
"message": "unknown error",
"schema": "[:> 6]",
"type": null,
"value": 1,
"in": [
"quiz"
]
...
I also trying to validate form-params, but it seems I cannot make it work. May you have any examples?
Have you looked at the tests @wonderlastking?
https://github.com/metosin/reitit/blob/master/test/cljc/reitit/ring_coercion_test.cljc
wow, thanks again ikitommi! No I didn't check them. I will now π
Is there a way to make reitit.frontend.history not URL-encode a specific path parameter? I have a route like /foo/*bar
, and I want to be able to use it to link to URLs like /foo/bar/baz
.