-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Draft: introduce strict mode #88
Draft: introduce strict mode #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks like it'll work! Just left some minor naming suggestions and looks like the CI needs to be made green to be able to merge this in.
I'm testing locally with flask to see if I get the exception. I've done the changes you have mentioned. I guess still documentation and tests are missing. I guess I should also write documentation and tests right? It would be nice to mention in the documentation this |
Yeah, maybe another section in |
I've added some docs and a test for testing the strict mode |
Awesome, looks good to me! I'll merge it in and try to push a release by the coming weekend. |
@siddhantgoel sorry to bother but did you have a chance to look at the release? Cause I would really like to use this library :D |
No worries, thanks for the reminder as I had completely forgotten about this, so sorry about that! But v1.13.0 should be available on PyPI now! |
yes it is there, thanks a lot! |
This is for issue #87
I've added a first draft of the strict mode, to sum up the changes:
In
parser.py
I've addedUnregisteredPartException
which is a subclass of theParseFailedException
.It has an additional field
part_name
so you can get what was the name of the unregistered field.StreamingFormDataParser
init function has an extra keyword argumentstrict
which defaults toFalse
.And it passes this argument to ctor of
_Parser
.In pyx file. I've added a new number in
ErrorGroup
._Parser
has 2 new fields,strict
andunknown_part
.The latter one is public, ctor sets the strict mode. And when we are switching the active target, if the new
target is an unregistered one, we set
unknown_part
,mark_error
and return new code from the enum.@siddhantgoel I would appreciate if you could take a look at it :)