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
'coerce' ignores 'nullable': True #269
Comments
this is similar to #268. |
Bump, this makes sense.. is there any possibility to get this? |
Is this feature released? I am using |
nikhaldi
pushed a commit
to nikhaldi/cerberus
that referenced
this issue
May 2, 2019
Only ignore exceptions if a value for a nullable field is not null. Previuosly all exceptions during custom coerction were ignored with nullable fields. The developer and/or user most likely wants to know about exceptions that happen during coercion - this leads to hard to debug problems otherwise. The purpose of the `e is not TypeError` condition was unclear. As far as I know this condition can never be false (`e` is an instance of an exception, not an exception class). I think this is still in line with the original intent of this code, which was to make common coercions like `float` work with nullable fields out of the box: pyeve#269
nikhaldi
pushed a commit
to nikhaldi/cerberus
that referenced
this issue
May 2, 2019
Only ignore exceptions if a value for a nullable field is not null. Previously all exceptions during custom coerction were ignored with nullable fields. The developer and/or user most likely wants to know about exceptions that happen during coercion - this leads to hard to debug problems otherwise. The purpose of the `e is not TypeError` condition was unclear. As far as I know this condition can never be false (`e` is an instance of an exception, not an exception class). I think this is still in line with the original intent of this code, which was to make common coercions like `float` work with nullable fields out of the box: pyeve#269
nikhaldi
pushed a commit
to nikhaldi/cerberus
that referenced
this issue
May 2, 2019
Only ignore exceptions if a value for a nullable field is not null. Previously all exceptions during custom coerction were ignored with nullable fields. The developer and/or user most likely wants to know about exceptions that happen during coercion - this leads to hard to debug problems otherwise. The purpose of the `e is not TypeError` condition was unclear. As far as I know this condition can never be false (`e` is an instance of an exception, not an exception class). I think this is still in line with the original intent of this code, which was to make common coercions like `float` work with nullable fields out of the box: pyeve#269
nikhaldi
pushed a commit
to nikhaldi/cerberus
that referenced
this issue
May 6, 2019
Only ignore exceptions if a value for a nullable field is not null. Previously all exceptions during custom coerction were ignored with nullable fields. The developer and/or user most likely wants to know about exceptions that happen during coercion - this leads to hard to debug problems otherwise. The purpose of the `e is not TypeError` condition was unclear. As far as I know this condition can never be false (`e` is an instance of an exception, not an exception class). I think this is still in line with the original intent of this code, which was to make common coercions like `float` work with nullable fields out of the box: pyeve#269
nikhaldi
pushed a commit
to nikhaldi/cerberus
that referenced
this issue
May 6, 2019
Only ignore exceptions if a value for a nullable field is not null. Previously all exceptions during custom coerction were ignored with nullable fields. The developer and/or user most likely wants to know about exceptions that happen during coercion - this leads to hard to debug problems otherwise. The purpose of the `e is not TypeError` condition was unclear. As far as I know this condition can never be false (`e` is an instance of an exception, not an exception class). I think this is still in line with the original intent of this code, which was to make common coercions like `float` work with nullable fields out of the box: pyeve#269
nikhaldi
pushed a commit
to nikhaldi/cerberus
that referenced
this issue
May 6, 2019
Only ignore exceptions if a value for a nullable field is not null. Previously all exceptions during custom coerction were ignored with nullable fields. The developer and/or user most likely wants to know about exceptions that happen during coercion - this leads to hard to debug problems otherwise. The purpose of the `e is not TypeError` condition was unclear. As far as I know this condition can never be false (`e` is an instance of an exception, not an exception class). I think this is still in line with the original intent of this code, which was to make common coercions like `float` work with nullable fields out of the box: pyeve#269
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
but expected:
This behavior can be logical (i can set something like
'coerce': lambda x: int(x) if x is not None else None
), but I do not think it's convenient, because I have to specifynullable
rule twice: in schema and in callable. I think,nullable
should be checked first, and if value is None, thencoerce
callable should not be called.If it's a bug and if architecture allows to fix this, please fix this :)
If it's a feature, please add a note about
nullable
in value coercion documentation (better with an example).The text was updated successfully, but these errors were encountered: