Open
Conversation
atmo
suggested changes
Jul 22, 2019
| dict: A, possibly, new JSON Schema that has been post processed and | ||
| altered. | ||
| """ | ||
| if not isinstance(field, fields.String): |
Contributor
There was a problem hiding this comment.
I recommend raising an UnsupportedValueError here as I did for other validators. marshmallow will fail on non-strings anyway:
>>> from marshmallow import fields
>>> from marshmallow.validate import Regexp
>>> f = fields.Integer(validate=Regexp(".*"))
>>> f.deserialize(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lynx/projects/marshmallow-jsonschema/.venv/lib/python3.7/site-packages/marshmallow/fields.py", line 301, in deserialize
self._validate(output)
File "/home/lynx/projects/marshmallow-jsonschema/.venv/lib/python3.7/site-packages/marshmallow/fields.py", line 224, in _validate
r = validator(value)
File "/home/lynx/projects/marshmallow-jsonschema/.venv/lib/python3.7/site-packages/marshmallow/validate.py", line 362, in __call__
if self.regex.match(value) is None:
TypeError: expected string or bytes-like objectCustom fields have to be handled with care though as they are not required to be an instance of fields.String. Though they are not supported yet, there is an attempt in #22.
Contributor
|
Hi @fuhrysteve ! Could you please resolve the conflicts in this PR? It would be great to have it merged into master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves conflicts from #24