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

[ParamFetcher] Customize ConstraintViolation errors #731

Closed
pyrech opened this issue Mar 29, 2014 · 3 comments
Closed

[ParamFetcher] Customize ConstraintViolation errors #731

pyrech opened this issue Mar 29, 2014 · 3 comments

Comments

@pyrech
Copy link
Contributor

pyrech commented Mar 29, 2014

The feature introduced with #700 is really awesome. However, currently, the violation message returned by the validator is not really nice to output to an api client:

"the value given:\n the violation message\n"

This output is caused by: ConstraintViolation::__toString() and ConstraintViolationList::__toString(), called by throw new BadRequestHttpException((string) $errors); in ParamFetcher::cleanParamWithRequirements()

It could be better to display at least the name of the param which failed, if possible in first position, and without the "\n" char between value and message. An even better way would be to allow the customization of the message, what to you think about it?

@lsmith77
Copy link
Member

lsmith77 commented Apr 2, 2014

can you work on a PR?

@pyrech
Copy link
Contributor Author

pyrech commented Apr 2, 2014

I will give it a look tonight ;)

@pyrech
Copy link
Contributor Author

pyrech commented Apr 3, 2014

Closing in favor of #734

@pyrech pyrech closed this as completed Apr 3, 2014
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