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

Errors passed to model state don't contain property that failed #83

Open
jababda opened this issue Feb 8, 2018 · 1 comment
Open

Errors passed to model state don't contain property that failed #83

jababda opened this issue Feb 8, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@jababda
Copy link

jababda commented Feb 8, 2018

When executing JsonPatchDocument.ApplyTo(obj) the property name doesn't get passed into the error message.

e.g. passing "" to a required property returns "The value '' is invalid for target location." rather then "The value '' is invalid for target {property name}."

Looking at the surrounding code and making some pretty big assumptions i believe this could be resolved by changing:
errorMessage = Resources.FormatInvalidValueForProperty(value);
To
errorMessage = Resources.FormatInvalidValueForProperty(value, segment);

Certainly for my use case this would be an awesome change, and I imagine this would be very helpful to others as well :).

@KevinDockx
Copy link
Owner

Hmm, that definitely doesn't sound right. I'll look into it and provide a fix :)

@KevinDockx KevinDockx self-assigned this Feb 12, 2018
@KevinDockx KevinDockx added the bug label Feb 12, 2018
@KevinDockx KevinDockx added this to the Release 2.1.1 milestone Feb 12, 2018
@KevinDockx KevinDockx modified the milestones: Release 2.1.1, Backlog May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants