@@ -99,9 +99,10 @@ Validators need to be added to the `ValidatorTypeCache`. This should be done onc
9999ValidatorTypeCache validatorTypeCache = new ();
100100validatorTypeCache .AddValidatorsFromAssembly (assemblyContainingValidators );
101101Schema schema = new ();
102+ schema .UseFluentValidation ();
102103DocumentExecuter executer = new ();
103104```
104- <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L18-L25 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-startconfig ' title =' Start of snippet ' >anchor</a ></sup >
105+ <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L18-L26 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-startconfig ' title =' Start of snippet ' >anchor</a ></sup >
105106<!-- endSnippet -->
106107
107108Generally ` ValidatorTypeCache ` is scoped per app and can be collocated with ` Schema ` , ` DocumentExecuter ` initialization.
@@ -129,7 +130,7 @@ options.UseFluentValidation(validatorTypeCache);
129130
130131var executionResult = await executer .ExecuteAsync (options );
131132```
132- <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L30-L42 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-usefluentvalidation ' title =' Start of snippet ' >anchor</a ></sup >
133+ <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L31-L43 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-usefluentvalidation ' title =' Start of snippet ' >anchor</a ></sup >
133134<!-- endSnippet -->
134135
135136
@@ -156,7 +157,7 @@ public class MyUserContext :
156157 public string MyProperty { get ; }
157158}
158159```
159- <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L45-L58 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-contextimplementingdictionary ' title =' Start of snippet ' >anchor</a ></sup >
160+ <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L46-L59 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-contextimplementingdictionary ' title =' Start of snippet ' >anchor</a ></sup >
160161<!-- endSnippet -->
161162
162163The ` ExecutionOptions.UserContext ` can then be set as follows:
@@ -176,7 +177,7 @@ ExecutionOptions options = new()
176177};
177178options .UseFluentValidation (validatorTypeCache );
178179```
179- <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L62-L76 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-executequerywithcontextimplementingdictionary ' title =' Start of snippet ' >anchor</a ></sup >
180+ <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L63-L77 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-executequerywithcontextimplementingdictionary ' title =' Start of snippet ' >anchor</a ></sup >
180181<!-- endSnippet -->
181182
182183
@@ -203,7 +204,7 @@ ExecutionOptions options = new()
203204};
204205options .UseFluentValidation (validatorTypeCache );
205206```
206- <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L81-L101 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-executequerywithcontextinsidedictionary ' title =' Start of snippet ' >anchor</a ></sup >
207+ <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L82-L102 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-executequerywithcontextinsidedictionary ' title =' Start of snippet ' >anchor</a ></sup >
207208<!-- endSnippet -->
208209
209210
@@ -222,7 +223,7 @@ ExecutionOptions options = new()
222223};
223224options .UseFluentValidation (validatorTypeCache );
224225```
225- <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L106-L116 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-nocontext ' title =' Start of snippet ' >anchor</a ></sup >
226+ <sup ><a href =' /src/Tests/Snippets/QueryExecution.cs#L107-L117 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-nocontext ' title =' Start of snippet ' >anchor</a ></sup >
226227<!-- endSnippet -->
227228
228229Then the ` UseFluentValidation ` method will instantiate it to a new ` Dictionary<string, object> ` .
@@ -354,10 +355,10 @@ public class QueryTests
354355 };
355356 ResolveFieldContext fieldContext = new ()
356357 {
357- Arguments = new Dictionary <string , object >
358+ Arguments = new Dictionary <string , ArgumentValue >
358359 {
359360 {
360- " input" , input
361+ " input" , new ArgumentValue ( input , ArgumentSource . Variable )
361362 }
362363 },
363364 UserContext = userContext
@@ -376,12 +377,14 @@ public class QueryTests
376377 FluentValidationExtensions .AddCacheToContext (
377378 userContext ,
378379 ValidatorCacheBuilder .Instance );
380+
381+ var value = new Dictionary <string , object >();
379382 ResolveFieldContext fieldContext = new ()
380383 {
381- Arguments = new Dictionary <string , object >
384+ Arguments = new Dictionary <string , ArgumentValue >
382385 {
383386 {
384- " input" , new Dictionary < string , object >( )
387+ " input" , new ArgumentValue ( value , ArgumentSource . Variable )
385388 }
386389 },
387390 UserContext = userContext
@@ -392,7 +395,7 @@ public class QueryTests
392395 }
393396}
394397```
395- <sup ><a href =' /src/SampleWeb.Tests/QueryTests.cs#L9-L67 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-querytests ' title =' Start of snippet ' >anchor</a ></sup >
398+ <sup ><a href =' /src/SampleWeb.Tests/QueryTests.cs#L10-L71 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-querytests ' title =' Start of snippet ' >anchor</a ></sup >
396399<!-- endSnippet -->
397400
398401
0 commit comments