Skip to content

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

@jababda

Description

@jababda

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions