← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1557609] Re: error message for field name exceeded max allowed is less than helpful

 

Reviewed:  https://review.openstack.org/299036
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=815a9247758a79551cb106b09e2f5a7c1bd61cfc
Submitter: Jenkins
Branch:    master

commit 815a9247758a79551cb106b09e2f5a7c1bd61cfc
Author: Colleen Murphy <colleen@xxxxxxxxxxx>
Date:   Tue Mar 29 16:31:50 2016 -0700

    Improve error message for schema validation
    
    Without this patch, users who enter long project names that fail the
    jsonschema validation are faced with the message:
    
      Invalid input for field 'name'. The value is '<very long name>'.
    
    which simply echoes back the input value and does not provide
    information about what was wrong with the input. This is less than
    helpful. This patch modifies the validator error message to, in
    addition to supplying the name of the failed resource, also provide the
    error message directly from the jsonschema exception. In apparently all
    cases this message includes the value the user entered, so we can omit
    echoing the value back. An example of the new message is:
    
     Invalid input for field 'name': u'<very long name>' is too long
    
    An alternative to this patch would be to follow the pattern given by
    the "create_user" action, where jsonschema does not validate the
    maxLength and it is instead validated at the core level by a
    keystone.common.clean function. This would solve bug 1557609 and give
    us a more descriptive error message, but moves validation further down
    the chain and contradicts bp api-validation.
    
    Change-Id: I3e5a41be91ebe87f33eab9e545f330dc141bb88e
    Closes-bug: #1557609


** Changed in: keystone
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1557609

Title:
  error message for field name exceeded max allowed is less than helpful

Status in OpenStack Identity (keystone):
  Fix Released

Bug description:
  When creating a project with name which exceeds the maximum length (of
  64 chars), we get a very generic error message.

  openstack --os-identity-api-version 3 --os-auth-url https://localhost:5000/v3 --os-username admin --os-user-domain-id default --os-project-name admin --os-project-domain-id default --os-password secrete project create --domain default this-is-a-very-very-very-very-very-very-very-very-very-very-very-very-very-long-project-name
  Invalid input for field 'name'. The value is 'this-is-a-very-very-very-very-very-very-very-very-very-very-very-very-very-long-project-name'. (HTTP 400) (Request-ID: req-d8d7d046-2c68-4c41-ba8c-d3165d86ae50)

  
  The error message is less than helpful for ordinary users. It needs to be more specific, perhaps something like "Invalid project name. It must be no more than 64 characters in length."?

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1557609/+subscriptions


References