JsonPatch icon indicating copy to clipboard operation
JsonPatch copied to clipboard

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

Open jababda opened this issue 7 years ago • 1 comments

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 :).

jababda avatar Feb 08 '18 04:02 jababda

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

KevinDockx avatar Feb 12 '18 16:02 KevinDockx