Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Model Validation Errors text should be more inconsistent. #2493

Closed
harshgMSFT opened this issue May 4, 2015 · 2 comments
Closed

Model Validation Errors text should be more inconsistent. #2493

harshgMSFT opened this issue May 4, 2015 · 2 comments

Comments

@harshgMSFT
Copy link
Contributor

For example error for the following says :
The 'OrderIds' property is required.

private class Order
{
         [BindRequired]
         public List<int> OrderIds { get; set; }
}

While the error for the following scenario says :
The OrderIds field is required.

private class Order
{
         [Required]
         public List<int> OrderIds { get; set; }
}

This is because error for BindRequired is added by MutableObjectBinder and not the validation code.

@Eilon Eilon changed the title Model Validation Errors text should be consistent. Model Validation Errors text should be more inconsistent. May 8, 2015
@Eilon
Copy link
Member

Eilon commented May 8, 2015

The case of [BindRequired] is one where the app developer has a programming error because they didn't post a value at all for the field, and so the displayed error could be improved to indicate something like "A value for the '{0}' property was not provided."

The Data Annotations one is fine because that represents a user error (user didn't type a value into a required field).

@Eilon Eilon added this to the 6.0.0-beta5 milestone May 8, 2015
@Eilon Eilon added the bug label May 8, 2015
@danroth27 danroth27 modified the milestones: 6.0.0-beta6, 6.0.0-beta5 May 11, 2015
@Eilon
Copy link
Member

Eilon commented Jun 5, 2015

Dup of #2526.

@Eilon Eilon closed this as completed Jun 5, 2015
@Eilon Eilon added the duplicate label Jun 5, 2015
dougbu added a commit that referenced this issue Jun 5, 2015
…indRequired]`

- only use MVC error message when `[BindRequired]` is violated
- update that error message to more clearly describe the problem
- enable all tests skipped due to dupe bug #2493
- update expectations of a few tests using the old messages

nits:
- rename `ModelBinding_MissingRequiredMember` to `ModelBinding_MissingBindRequiredMember`
- remove `<param>` description of removed `requiredValidator` parameter
- remove unused `MutableObjectModelBinderTest.GetRequiredValidator()`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants