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

Label declaration/Validation #803

Closed
adrien-candiotti opened this issue Jan 19, 2016 · 1 comment
Closed

Label declaration/Validation #803

adrien-candiotti opened this issue Jan 19, 2016 · 1 comment
Assignees
Labels
bug Bug or defect
Milestone

Comments

@adrien-candiotti
Copy link

Label declaration on Joi objects shadows the name of attributes that fails to be validated in the error message.

Example:

Joi.object({color: Joi.string().regex(/#[0-9a-fA-F]{6}/)}).label("test");

If I post a payload with a color field wrongly formatted I get:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "child \"test\" fails because [\"test\" with value \"string\" fails to match the required pattern: /^[0-9A-Fa-f]{6}$/]",
  "validation": {
    "source": "payload",
    "keys": [
      "color"
    ]
  }
}
@Marsup Marsup added the bug Bug or defect label Jan 19, 2016
@Marsup Marsup self-assigned this Jan 19, 2016
@Marsup Marsup added this to the 7.2.2 milestone Jan 19, 2016
@Marsup Marsup closed this as completed in 8982a05 Jan 19, 2016
Marsup added a commit that referenced this issue Jan 19, 2016
Marsup added a commit that referenced this issue Jan 19, 2016
@Marsup
Copy link
Collaborator

Marsup commented Jan 19, 2016

Thanks for the report, it's fixed and published.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants