Using Malli for coercion. How do I set up a (query) param for a list of values conforming to a regex?
(def id-regex #"^[A-Za-z\d\-_]{10}$")
(def routes
["" {:coercion reitit.coercion.malli/coercion}
["/some-path"
{:get {:handler some-handler-fn
:parameters {:query
[:map
[:some-arg
[:sequential
[:re id-regex]]]]}}}]])
The endpoint shows up in Swagger docs, but when I test it with one or more values, the endpoint throws me errors.
{
"schema": "[:map {:closed true} [:some-arg [:sequential [:re #\"^[A-Za-z\\d\\-_]{10}$\"]]]]",
"errors": [
{
"in": [
"some-arg"
],
"path": [
"some-arg"
],
"message": "invalid type",
"type": "malli.core/invalid-type",
"schema": "[:sequential [:re #\"^[A-Za-z\\d\\-_]{10}$\"]]",
"value": "1234567890,1234567891"
}
],
"value": {
"some-arg": "1234567890,1234567891"
},
"type": "reitit.coercion/request-coercion",
"coercion": "malli",
"in": [
"request",
"query-params"
],
"humanized": {
"some-arg": [
"invalid type"
]
}
}
Looks like it's processing the query parameter as just a string instead of a sequence of strings.