Exemplo n.º 1
0
        /// <summary>
        /// When overridden in a child class,populates this introspected type using its parent schema to fill in any details about
        /// other references in this instance.
        /// </summary>
        /// <param name="schema">The schema.</param>
        public override void Initialize(IntrospectedSchema schema)
        {
            var list = new List <IntrospectedInputValueType>();

            foreach (var arg in _field.Arguments.Where(x => !x.ArgumentModifiers.HasFlag(GraphArgumentModifiers.Internal)))
            {
                var introspectedType = schema.FindIntrospectedType(arg.TypeExpression.TypeName);
                introspectedType = Introspection.WrapBaseTypeWithModifiers(introspectedType, arg.TypeExpression);
                var inputValue = new IntrospectedInputValueType(arg, introspectedType);
                inputValue.Initialize(schema);
                list.Add(inputValue);
            }

            this.Arguments = list;
        }
        /// <summary>
        /// When overridden in a child class,populates this introspected type using its parent schema to fill in any details about
        /// other references in this instance.
        /// </summary>
        /// <param name="schema">The schema.</param>
        public override void Initialize(IntrospectedSchema schema)
        {
            var list = new List <IntrospectedInputValueType>();

            foreach (var arg in this.GraphType.Arguments)
            {
                var introspectedType = schema.FindIntrospectedType(arg.TypeExpression.TypeName);
                introspectedType = Introspection.WrapBaseTypeWithModifiers(introspectedType, arg.TypeExpression);
                var inputValue = new IntrospectedInputValueType(arg, introspectedType);
                list.Add(inputValue);
            }

            this.Arguments = list;
            this.Locations = this.GraphType.Locations.GetIndividualFlags <DirectiveLocation>().ToList();
            this.Publish   = this.GraphType.Publish;
        }
        private void LoadInputValues(IntrospectedSchema schema)
        {
            if (!(this.GraphType is IInputObjectGraphType inputType))
                return;

            // populate inputFields collection
            // populate the fields for this object type
            var inputFields = new List<IntrospectedInputValueType>();
            foreach (var field in inputType.Fields)
            {
                var introspectedType = schema.FindIntrospectedType(field.TypeExpression.TypeName);
                introspectedType = Introspection.WrapBaseTypeWithModifiers(introspectedType, field.TypeExpression);
                var inputField = new IntrospectedInputValueType(field, introspectedType);
                inputField.Initialize(schema);
                inputFields.Add(inputField);
            }

            this.InputFields = inputFields;
        }