@@ -20,13 +20,13 @@ namespace JsonApiDotNetCore.Errors
20
20
[ PublicAPI ]
21
21
public sealed class InvalidModelStateException : JsonApiException
22
22
{
23
- public InvalidModelStateException ( IReadOnlyDictionary < string , ModelStateEntry > modelState , Type modelType , bool includeExceptionStackTraceInErrors ,
23
+ public InvalidModelStateException ( IReadOnlyDictionary < string , ModelStateEntry ? > modelState , Type modelType , bool includeExceptionStackTraceInErrors ,
24
24
IResourceGraph resourceGraph , Func < Type , int , Type ? > ? getCollectionElementTypeCallback = null )
25
25
: base ( FromModelStateDictionary ( modelState , modelType , resourceGraph , includeExceptionStackTraceInErrors , getCollectionElementTypeCallback ) )
26
26
{
27
27
}
28
28
29
- private static IEnumerable < ErrorObject > FromModelStateDictionary ( IReadOnlyDictionary < string , ModelStateEntry > modelState , Type modelType ,
29
+ private static IEnumerable < ErrorObject > FromModelStateDictionary ( IReadOnlyDictionary < string , ModelStateEntry ? > modelState , Type modelType ,
30
30
IResourceGraph resourceGraph , bool includeExceptionStackTraceInErrors , Func < Type , int , Type ? > ? getCollectionElementTypeCallback )
31
31
{
32
32
ArgumentGuard . NotNull ( modelState , nameof ( modelState ) ) ;
@@ -45,15 +45,15 @@ private static IEnumerable<ErrorObject> FromModelStateDictionary(IReadOnlyDictio
45
45
}
46
46
47
47
private static IEnumerable < ( ModelStateEntry entry , string ? sourcePointer ) > ResolveSourcePointers (
48
- IReadOnlyDictionary < string , ModelStateEntry > modelState , Type modelType , IResourceGraph resourceGraph ,
48
+ IReadOnlyDictionary < string , ModelStateEntry ? > modelState , Type modelType , IResourceGraph resourceGraph ,
49
49
Func < Type , int , Type ? > ? getCollectionElementTypeCallback )
50
50
{
51
51
foreach ( string key in modelState . Keys )
52
52
{
53
53
var rootSegment = ModelStateKeySegment . Create ( modelType , key , getCollectionElementTypeCallback ) ;
54
54
string ? sourcePointer = ResolveSourcePointer ( rootSegment , resourceGraph ) ;
55
55
56
- yield return ( modelState [ key ] , sourcePointer ) ;
56
+ yield return ( modelState [ key ] ! , sourcePointer ) ;
57
57
}
58
58
}
59
59
0 commit comments