protected virtual InputObjectGraphType ToInputObjectType(GraphQLInputObjectTypeDefinition inputDef)
        {
            var name       = (string)inputDef.Name.Value;
            var typeConfig = Types.For(name);

            AssertKnownType(typeConfig);

            var type = new InputObjectGraphType
            {
                Name        = name,
                Description = typeConfig.Description ?? inputDef.Description?.Value.ToString() ?? inputDef.Comment?.Text.ToString(),
            }.SetAstType(inputDef);

            OverrideDeprecationReason(type, typeConfig.DeprecationReason);

            typeConfig.CopyMetadataTo(type);

            if (inputDef.Fields != null)
            {
                foreach (var f in inputDef.Fields)
                {
                    type.AddField(ToFieldType(type.Name, f));
                }
            }

            return(type);
        }
Esempio n. 2
0
        protected virtual InputObjectGraphType ToInputObjectType(GraphQLInputObjectTypeDefinition inputDef)
        {
            var type = new InputObjectGraphType();

            type.Name = inputDef.Name.Value;
            var fields = inputDef.Fields.Select(ToFieldType);

            fields.Apply(f => type.AddField(f));

            return(type);
        }
Esempio n. 3
0
        private string PrintInputObjectTypeDefinition(GraphQLInputObjectTypeDefinition node)
        {
            var name       = PrintName(node.Name);
            var directives = node.Directives?.Select(PrintDirective);
            var fields     = node.Fields?.Select(PrintInputValueDefinition);

            return(Join(new[]
            {
                "input",
                name,
                Join(directives, " "),
                Block(fields) ?? "{ }"
            },
                        " "));
        }
Esempio n. 4
0
        protected virtual InputObjectGraphType ToInputObjectType(GraphQLInputObjectTypeDefinition inputDef)
        {
            var type = new InputObjectGraphType();

            type.Name = inputDef.Name.Value;

            ApplyDeprecatedDirective(inputDef.Directives, reason =>
            {
                type.DeprecationReason = reason;
            });

            var fields = inputDef.Fields.Select(x => ToFieldType(type.Name, x));

            fields.Apply(f => type.AddField(f));

            return(type);
        }
Esempio n. 5
0
        protected virtual InputObjectGraphType ToInputObjectType(GraphQLInputObjectTypeDefinition inputDef)
        {
            var typeConfig = Types.For(inputDef.Name.Value);

            var type = new InputObjectGraphType
            {
                Name        = inputDef.Name.Value,
                Description = typeConfig.Description ?? inputDef.Comment?.Text
            };

            CopyMetadata(type, typeConfig);

            var fields = inputDef.Fields.Select(x => ToFieldType(type.Name, x));

            fields.Apply(f => type.AddField(f));

            return(type);
        }
Esempio n. 6
0
 public ObjectType(GraphQLInputObjectTypeDefinition definition)
 {
     this.definitionInput = definition;
     Name = definition.Name?.Value;
 }
        public virtual GraphQLInputObjectTypeDefinition BeginVisitInputObjectTypeDefinition(GraphQLInputObjectTypeDefinition node)
        {
            if (node.Directives != null)
            {
                this.BeginVisitNodeCollection(node.Directives);
            }

            if (node.Fields != null)
            {
                this.BeginVisitNodeCollection(node.Fields);
            }

            return(node);
        }