metosin / reitit

A fast data-driven routing library for Clojure/Script
https://cljdoc.org/d/metosin/reitit/
Eclipse Public License 1.0
1.4k stars 252 forks source link

`reitit.coercion.malli` - invalid keys for :responses are accepted #667

Open vemv opened 4 months ago

vemv commented 4 months ago

I had been mistakenly using the following:

:responses {:200 {:body SomeMalliSchema}
            :500 {:body SomeOtherSchema}}

Where the mistake was using :200 instead of 200.

To make matters more confusing, :200 does work for Swagger schema emission. It's just coercion that expects strictly a 200 and ignores :200. It also happily accepts other invalid keys like :foo, 'bar, [1 2 3], etc.

I'd appreciate a stricter validation here - especially as it's a fairly crititical part of any Reitit-based system.

Thanks - V