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

Empty string data_key disallowed #1378

Closed
jtrakk opened this issue Sep 5, 2019 · 2 comments · Fixed by #1379

Comments

@jtrakk
Copy link

commented Sep 5, 2019

Having an empty string as data_key doesn't seem to work.

import marshmallow
from marshmallow import fields


class RootSchema(marshmallow.Schema):
    x = fields.Raw(data_key="")


RootSchema().load({'': 1})
---> 14 RootSchema().load({'': 1})

~/.pyenv/versions/3.7.3/lib/python3.7/site-packages/marshmallow/schema.py in load(self, data, many, partial, unknown)
    730         """
    731         return self._do_load(
--> 732             data, many=many, partial=partial, unknown=unknown, postprocess=True
    733         )
    734 

~/.pyenv/versions/3.7.3/lib/python3.7/site-packages/marshmallow/schema.py in _do_load(self, data, many, partial, unknown, postprocess)
    892             exc = ValidationError(errors, data=data, valid_data=result)
    893             self.handle_error(exc, data)
--> 894             raise exc
    895 
    896         return result

ValidationError: {'': ['Unknown field.']}

marshmallow-3.0.2

@sloria sloria added the bug label Sep 5, 2019

@sloria

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

Thanks for reporting. Was able to reproduce this. Will look into it.

@sloria

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

Bug fix is released in 3.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.