API Validation error could be more helpful if we provide the field name in the error message

Bug #1201993 reported by Saurabh Surana
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Fix Released
Undecided
Justin Hopper

Bug Description

The error message that I received here, was clear about what the issue is, but it didn't tell me anything about where the validation has failed (for which field specifically). This will be helpful if we have multiple of these fields in the object which can go wrong

# trove-cli backup create --name Test --instance beb407e9-ae07-49ea-8cde-c1015ac5caee
REQUEST:
curl -i https://<API>/v1.0/<TenantID>/backups -X POST -H "X-Auth-Project-Id: <Tenant>" -H "User-Agent: python-troveclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:<Token>" -d '{"backup": {"instance": "beb407e9-ae07-49ea-8cde-c1015ac5caee", "name": "Test", "description": null}}'
BODY: {
    "backup": {
        "description": null,
        "instance": "beb407e9-ae07-49ea-8cde-c1015ac5caee",
        "name": "Test"
    }
}

RESPONSE HEADERS: {'date': 'Tue, 16 Jul 2013 22:18:15 GMT', 'status': '400', 'content-length': '90', 'content-type': 'application/json; charset=UTF-8'}
RESPONSE BODY : {
    "badRequest": {
        "code": 400,
        "message": "Validation error: None is not of type 'string'"
    }
}
Validation error: None is not of type 'string' (HTTP 400)

description: updated
Changed in trove:
assignee: nobody → Justin Hopper (justin-hopper)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to trove (master)

Fix proposed to branch: master
Review: https://review.openstack.org/37706

Changed in trove:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to trove (master)

Reviewed: https://review.openstack.org/37706
Committed: http://github.com/openstack/trove/commit/988d666af7e9d4f6c5bb036f99dc45e54fe5672a
Submitter: Jenkins
Branch: master

commit 988d666af7e9d4f6c5bb036f99dc45e54fe5672a
Author: justin-hopper <email address hidden>
Date: Thu Jul 18 08:45:36 2013 -0700

    Added param name to validation error messages

        Validation errors now pre-fixed with param name so that its
        easier to troubleshoot

    Fixes: bug 1201993

    Change-Id: Icff176de9f18fe08749473ee3d68c70c55be2c9c

Changed in trove:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in trove:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in trove:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.