flask-restless icon indicating copy to clipboard operation
flask-restless copied to clipboard

"validation_errors": "Could not determine specific validation errors"

Open hussaintamboli opened this issue 9 years ago • 3 comments

I tried to make a POST request to my API

import requests
import json

url = 'http://127.0.0.1:5000/api/candidate'
data = {
    'first_name' : 'Hussain',
    'country_id' : 1,
    'city' : 'pune',
    'email' : '[email protected]',
    'phone' : '919975542588',
    'education' : 'B Tech',
    'department' : 1,
    'experinece_years' : 2
}
json_data = json.dumps(data)

try:
    result = requests.post(url, data=json_data, headers={"Content-Type" : "application/json"})
    print(result)
    print(result.text)
except requests.exceptions.ConnectionError as conn_err:
    print(conn_err)

And I get an error

<Response [400]>
{
     "validation_errors": "Could not determine specific validation errors"
}

On the server side it says

ERROR in views [/home/hussain/workspace/magic-chips/backend/venv/local/lib/python2.7/site-packages/flask_restless/views.py:413]:

need more than 1 value to unpack

I looked for this kind of issue but didn't find any help.

Also I checked line 413 from views.py and I am guessing the restless is not able to identify the exception.

hussaintamboli avatar Apr 16 '15 08:04 hussaintamboli

@hussaintamboli

Look at this method : https://github.com/jfinkels/flask-restless/blob/master/flask_restless/views.py#L389 In declared API endpoint you need to provide validation_exceptions classes that return expected by extract_error_messages structures.

zablotski avatar Nov 18 '15 09:11 zablotski

The validation checking in Flask-Restless is very shaky. If you can provide a minimal working example that causes the error, I can perhaps address this issue.

jfinkels avatar Feb 04 '16 08:02 jfinkels

so, this still a bug?

coanor avatar Dec 10 '17 15:12 coanor