public static void CoerceVariables( IRequestContext context, VariableCoercionHelper coercionHelper, IReadOnlyList <VariableDefinitionNode> variableDefinitions) { if (context.Variables is null) { if (variableDefinitions.Count == 0) { context.Variables = _noVariables; } else { var coercedValues = new Dictionary <string, VariableValueOrLiteral>(); coercionHelper.CoerceVariableValues( context.Schema, variableDefinitions, context.Request.VariableValues ?? _empty, coercedValues); context.Variables = new VariableValueCollection(coercedValues); } } }
public OperationVariableCoercionMiddleware( RequestDelegate next, VariableCoercionHelper coercionHelper) { _next = next ?? throw new ArgumentNullException(nameof(next)); _coercionHelper = coercionHelper ?? throw new ArgumentNullException(nameof(coercionHelper)); }
public OperationVariableCoercionMiddleware( RequestDelegate next, IDiagnosticEvents diagnosticEvents, VariableCoercionHelper coercionHelper) { _next = next ?? throw new ArgumentNullException(nameof(next)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); _coercionHelper = coercionHelper ?? throw new ArgumentNullException(nameof(coercionHelper)); }
public OperationComplexityMiddleware( RequestDelegate next, DocumentValidatorContextPool contextPool, IComplexityAnalyzerOptionsAccessor options, IComplexityAnalyzerCache cache, VariableCoercionHelper coercionHelper) { _next = next ?? throw new ArgumentNullException(nameof(next)); _contextPool = contextPool ?? throw new ArgumentNullException(nameof(contextPool)); _settings = options?.Complexity ?? throw new ArgumentNullException(nameof(options)); _cache = cache ?? throw new ArgumentNullException(nameof(cache)); _coercionHelper = coercionHelper ?? throw new ArgumentNullException(nameof(coercionHelper)); _compiler = new ComplexityAnalyzerCompilerVisitor(_settings); }
public VariableCoercionBenchmarks() { _variableCoercionHelper = new VariableCoercionHelper(); _schema = SchemaBuilder.New().AddStarWarsTypes().Create(); }