示例#1
0
        protected override ISyntaxVisitorAction Leave(
            OperationDefinitionNode node,
            IDocumentValidatorContext context)
        {
            context.Max = context.Count > context.Max ? context.Count : context.Max;

            if (_options.MaxAllowedComplexity.HasValue &&
                _options.MaxAllowedComplexity < context.Max)
            {
                context.Errors.Add(context.MaxOperationComplexity(
                                       node, _options.MaxAllowedComplexity.Value, context.Max));
                return(Break);
            }

            return(base.Leave(node, context));
        }