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

Throws an AttributeError on JSON Array payload #24

Open
chumaumenze opened this issue Dec 16, 2019 · 1 comment
Open

Throws an AttributeError on JSON Array payload #24

chumaumenze opened this issue Dec 16, 2019 · 1 comment

Comments

@chumaumenze
Copy link
Contributor

chumaumenze commented Dec 16, 2019

When a request payload is a JSON array, the validator throws an
flask_validator.exceptions.ValidatorAttributeError: ('AttributeError', 'json passed, expecting json or form_data or query_string or headers')

JSON Arrays are converted to list and the validator does not validate list.

Say my JSON payload is:

[ 5, 6, 7, 8]

it throws:

  File "/Users/chumaumenze/Documents/projects/flask-validator/flask_validator/validator_engine.py", line 49, in validate
    validation_result = validators[validator_name](data.get(field, None),\
AttributeError: 'list' object has no attribute 'get'

 . . . .

  File "/Users/chumaumenze/Documents/projects/flask-validator/flask_validator/validator_engine.py", line 35, in inner_wrapper
    raise ValidatorAttributeError('AttributeError',\
flask_validator.exceptions.ValidatorAttributeError: ('AttributeError', 'json passed, expecting json or form_data or query_string or headers')
@adekoder
Copy link
Owner

Thanks will look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants