reitit

roklenarcic 2025-04-13T09:26:24.292059Z

Reitit malli coercion uses Lite syntax. Is there a way specify that I want a closed map schema, i.e. if there are extra query parameters I want 400 response?

opqdonut 2025-04-14T13:30:50.331089Z

you can use non-lite syntax as well, see for example: https://github.com/metosin/reitit/blob/master/examples/ring-malli-swagger/src/example/server.clj#L89-L96

opqdonut 2025-04-14T13:32:06.570819Z

by default, the malli coercion strips extra keys from params, so you need to also set :strip-extra-keys false in the options to reitit.coercion.malli/create

roklenarcic 2025-04-14T13:32:49.396739Z

I was more going for “throw user an error when they typo on a parameter name” behaviour

opqdonut 2025-04-14T13:33:45.252239Z

yes, you should get that by using :closed map schemas and :strip-extra-keys false

opqdonut 2025-04-14T13:34:38.133179Z

ah actually, malli closes the map schemas by default, so it should be enough to use :strip-extra-keys false

opqdonut 2025-04-14T13:35:03.883569Z

or rather, reitit malli coercion closes map schemas by default

opqdonut 2025-04-14T13:45:01.035469Z

note: extra query params are always accepted

roklenarcic 2025-04-14T19:26:31.009929Z

Ah yes

roklenarcic 2025-04-14T19:26:42.181969Z

Was trying it out with query params in particular