Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vemv opened this issue Mar 12, 2024 · 3 comments · May be fixed by #715
Open

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

vemv opened this issue Mar 12, 2024 · 3 comments · May be fixed by #715

Comments

@vemv
Copy link

vemv commented Mar 12, 2024

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

@ikitommi
Copy link
Member

ikitommi commented Jan 1, 2025

Agree, PR most welcome on this.

@filipesilva
Copy link

filipesilva commented Jan 10, 2025

Just wanted to mention I hit this too. Same thing: Swagger was fine with it, but it didn't fail coercion.

I'm up for doing a PR. So what should be the right thing to do here? Only accept int keys? Accept kw and int in both?

@ikitommi
Copy link
Member

For numbers, accepting just int-keys sense to me.

filipesilva added a commit to filipesilva/reitit that referenced this issue Jan 18, 2025
@filipesilva filipesilva linked a pull request Jan 18, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants