✨ Add verified MVC validation support for OptionalValue<T> with the package OptionalValues.Mvc#33
Conversation
OptionalValue<T>.SpecifiedValue
|
This should not be implemented in the main Move the MVC-specific validation behavior into a separate Required changes:
The MVC package should provide an The important behavior is: context.ValidationMetadata.ValidateChildren = false;for This should then be registered through MVC options, for example via an extension method on options.ModelMetadataDetailsProviders.Add(
new OptionalValueValidationMetadataProvider());or a package-specific helper such as: options.AddOptionalValuesMvc();The core |
Addressed in The core package no longer contains MVC-specific annotations or references. MVC child-validation suppression now lives in a new |
OptionalValue<T>.SpecifiedValueOptionalValue<T> into OptionalValues.Mvc
| /// Adds validation metadata support for <see cref="OptionalValue{T}"/> so MVC does not validate its child properties. | ||
| /// </summary> | ||
| /// <param name="options">The MVC options to configure.</param> | ||
| public static void AddOptionalValuesMvc(this MvcOptions options) |
There was a problem hiding this comment.
rename to AddOptionalValueSupport to align with the other extension methods.
|
@copilot please look at the comments |
Addressed in |
Addressed in |
OptionalValue<T> into OptionalValues.MvcOptionalValue<T> with the package OptionalValues.Mvc
This pull request introduces a new package,
OptionalValues.Mvc, which adds ASP.NET Core MVC validation metadata support for theOptionalValue<T>type.Fixes #31