66
77namespace Microsoft . AspNetCore . Http . Validation ;
88
9+ /// <summary>
10+ /// Provides configuration options for the validation system.
11+ /// </summary>
912public class ValidationOptions
1013{
14+ /// <summary>
15+ /// Gets the list of resolvers that provide validation metadata for types and parameters.
16+ /// Resolvers are processed in order, with the first resolver providing a non-null result being used.
17+ /// </summary>
18+ /// <remarks>
19+ /// Source-generated resolvers are typically inserted at the beginning of this list
20+ /// to ensure they are checked before any runtime-based resolvers.
21+ /// </remarks>
1122 public IList < IValidatableInfoResolver > Resolvers { get ; } = [ ] ;
23+
24+ /// <summary>
25+ /// Gets or sets the maximum depth for validation of nested objects.
26+ /// This prevents stack overflows from circular references or extremely deep object graphs.
27+ /// Default value is 32.
28+ /// </summary>
1229 public int MaxDepth { get ; set ; } = 32 ;
1330
31+ /// <summary>
32+ /// Attempts to get validation information for the specified type.
33+ /// </summary>
34+ /// <param name="type">The type to get validation information for.</param>
35+ /// <param name="validatableTypeInfo">When this method returns, contains the validation information for the specified type,
36+ /// if the type was found; otherwise, null.</param>
37+ /// <returns>true if validation information was found for the specified type; otherwise, false.</returns>
1438 public bool TryGetValidatableTypeInfo ( Type type , [ NotNullWhen ( true ) ] out ValidatableTypeInfo ? validatableTypeInfo )
1539 {
1640 foreach ( var resolver in Resolvers )
@@ -26,6 +50,13 @@ public bool TryGetValidatableTypeInfo(Type type, [NotNullWhen(true)] out Validat
2650 return false ;
2751 }
2852
53+ /// <summary>
54+ /// Attempts to get validation information for the specified parameter.
55+ /// </summary>
56+ /// <param name="parameterInfo">The parameter to get validation information for.</param>
57+ /// <param name="validatableParameterInfo">When this method returns, contains the validation information for the specified parameter,
58+ /// if validation information was found; otherwise, null.</param>
59+ /// <returns>true if validation information was found for the specified parameter; otherwise, false.</returns>
2960 public bool TryGetValidatableParameterInfo ( ParameterInfo parameterInfo , [ NotNullWhen ( true ) ] out ValidatableParameterInfo ? validatableParameterInfo )
3061 {
3162 foreach ( var resolver in Resolvers )
0 commit comments