-
Notifications
You must be signed in to change notification settings - Fork 149
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
Putting values in request.validated
before calling colander_body_validator
#503
Comments
Since we have that here: cornice/cornice/pyramidhook.py Lines 148 to 149 in c8d3ad6
I would assume that We can also explicitly document that a SequenceSchema cannot be used. I like your idea of not replacing the existing stuff, please go on ;) |
That's OK for me :) But ... there is a test: cornice/tests/test_validation.py Lines 419 to 426 in c8d3ad6
which relay on that behavior. I'm not sure it should because of this default value (empty dict) which would suggest that it should stay dict. Thing is that if someone would want to use |
Yes, we can bump a major version, no problem.
Makes sense! Yes! |
Let say we have a service:
Getting
something
from request.validated raises KeyError because of the line https://github.com/Cornices/cornice/blob/master/cornice/validators/_colander.py#L71which overwrites request.validated with request.validated['body'].
Fix for that would be just replacing line 71 in the cornice/validators/_colander.py:
with
but ... there is something that this change breaks.
What if someone sets schema which inherits from SequenceSchema rather than MappingSchema? Current code just rewrites request.validated (which is instantiated as dict in pyramidhook.py wrap_request()) with a list. I'm not sure if this should work like that or I'm just missing something?
The text was updated successfully, but these errors were encountered: