/// <summary>
        /// Executes the construction step the specified node to ensure it is "correct" in the context of the rule doing the valdiation.
        /// </summary>
        /// <param name="context">The validation context encapsulating a <see cref="SyntaxNode" /> that needs to be validated.</param>
        /// <returns><c>true</c> if the node is valid, <c>false</c> otherwise.</returns>
        public override bool Execute(DocumentConstructionContext context)
        {
            // at this stage we know thta we've encountered a complexvalue node
            // we can also garuntee that the active input value on the request is going to be the value container
            // for that ComplexvalueNode. It is to that container that we are adding a new argument.
            //
            // take for instance this sequence:
            //
            //      field(arg1: {childArg1: "value"  childArg2: value} )
            //
            // we are pointing at the argument "arg1"
            // which is a complexargument type having a value of QueryComplexInputValue which is a container of arguments
            // it is to that container that we are adding this new argument "childArg1" indicated by this InputItemNode
            // on the context.
            //
            // Note: this operation could be nested N levels deep such as with
            //       field(arg1: { childArg1:  {subChildArg1: value, subChildArg1: value} childArg2: 5} )
            // the scenario would be valid for:
            //      adding childArg1 or childArg2 to arg1
            //      adding subChildArg1 or subChildArg2 to childArg1
            var node        = (InputItemNode)context.ActiveNode;
            var inputObject = context.FindContextItem <QueryInputValue>() as QueryComplexInputValue;

            var ownerGraphType = inputObject.OwnerArgument.GraphType as IInputObjectGraphType;
            var field          = ownerGraphType.Fields[node.InputName.ToString()];
            var graphType      = context.DocumentContext.Schema.KnownTypes.FindGraphType(field);

            var argument = new QueryInputArgument(node, graphType, field.TypeExpression);

            context.AddDocumentPart(argument);
            return(true);
        }
        /// <summary>
        /// Executes the construction step the specified node to ensure it is "correct" in the context of the rule doing the valdiation.
        /// </summary>
        /// <param name="context">The validation context encapsulating a <see cref="SyntaxNode" /> that needs to be validated.</param>
        /// <returns><c>true</c> if the node is valid, <c>false</c> otherwise.</returns>
        public override bool Execute(DocumentConstructionContext context)
        {
            var node           = (InputItemNode)context.ActiveNode;
            var queryDirective = context.FindContextItem <QueryDirective>();

            var fieldArg  = queryDirective.Directive.Arguments[node.InputName.ToString()];
            var graphType = context.DocumentContext.Schema.KnownTypes.FindGraphType(fieldArg.TypeExpression.TypeName);
            var argument  = new QueryInputArgument(node, graphType, fieldArg.TypeExpression);

            context.AddDocumentPart(argument);

            return(true);
        }
 /// <summary>
 /// Adds the argument to the collection of arguments on this instance.
 /// </summary>
 /// <param name="argument">The argument.</param>
 public void AddArgument(QueryInputArgument argument)
 {
     this.Arguments.AddArgument(argument);
 }