-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-model-bindingseverity-majorThis label is used by an internal toolThis label is used by an internal tool
Milestone
Description
Describe the bug
background: nullable annotation context is enabled at project level
Actual behavior: A string-to-string dictionary with null-values for some keys passes model validation
Expected behavior: it should fail the model validation
To Reproduce
- Define an API-controller action that takes the below DTO as an argument
- Pass the below JSON to is using PostMan or a similar tool.
public class Dto
{
public IDictionary<string, string> Map { get; set; }
}{
"Map": {
"ok": "ok",
"oktoo": "5",
"notok": null
}
}Further technical details
- .NET Core 3.1
- Maybe related to API Validation error for Dictionary with null value since Preview 8 #13512
- See DictionaryModelBinderIntegrationTest.DictionaryModelBinder_DictionaryOfSimpleType_NullValue_DoesNotResultInRequiredValidation() - it validates the current behavior, which seems to me to be wrong, if nullable annotation context is enabled
zoriyadzmitry-lahoda
Metadata
Metadata
Assignees
Labels
affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-model-bindingseverity-majorThis label is used by an internal toolThis label is used by an internal tool