Esempio n. 1
0
        public static GraphQLDocument Error(GraphQLError error)
        {
            var doc = new GraphQLDocument();

            doc.errors.Add(error);
            return(doc);
        }
Esempio n. 2
0
 public void Resolve(GraphQLDocument doc)
 {
     this.rootType = doc.ResolveType(this.definition.TypeCondition) as IGraphQLFieldCollection;
     this.Selection.Resolve(doc, this.rootType);
     this.Path  = doc.ResolveQuerySource(this.definition.Location);
     this.Query = doc.ResolveFragment(this.definition);
 }
Esempio n. 3
0
        public static GraphQLDocument Error(ErrorCodes code, string message)
        {
            var doc = new GraphQLDocument();

            doc.AddError(code, message);
            return(doc);
        }
Esempio n. 4
0
 public void Resolve(GraphQLDocument doc)
 {
     this.Fields = this.definition.Fields.Select(x => new Field(x)).ToList();
     foreach (Field f in this.Fields)
     {
         f.Resolve(doc);
     }
 }
Esempio n. 5
0
 private IEnumerable <InterfaceType> ResolveInterfaces(GraphQLDocument doc)
 {
     foreach (var interfaceDefinitionLookup in this.definition.Interfaces)
     {
         var actualinterface = doc.ResolveType(interfaceDefinitionLookup);
         yield return(actualinterface as InterfaceType);
     }
 }
Esempio n. 6
0
        public void Resolve(GraphQLDocument doc)
        {
            Paramaters = operation.VariableDefinitions?.ToDictionary(x => x.Variable.Name.Value, x => doc.ResolveValueType(x.Type)) ?? new Dictionary <string, ValueTypeReference>();

            var rootType = doc.ResolveType(operation.Operation) as IGraphQLFieldCollection;

            (this.Query, this.Path) = doc.ResolveQuery(operation.Location);

            Selection.Resolve(doc, rootType);
        }
Esempio n. 7
0
        internal static Field TypeName(GraphQLDocument doc)
        {
            Field field = new Field("__typename");

            field.Type = new ValueTypeReference
            {
                Type = doc.ResolveType("String"),
                CanCollectionBeNull = false,
                CanValueBeNull      = false,
                IsCollection        = false
            };
            return(field);
        }
Esempio n. 8
0
        public void Resolve(GraphQLDocument doc)
        {
            this.Type = doc.ResolveValueType(this.definition.Type);

            //if(this.definition.DefaultValue is ScalerValues sv)!!!
            //{
            //    this.DefaultValue = sv.Value;
            //}
            //else
            {
                this.DefaultValue = this.definition.DefaultValue?.ToString();
            }


            this.Type = doc.ResolveValueType(this.definition.Type);
        }
Esempio n. 9
0
        public void Resolve(GraphQLDocument doc)
        {
            this.Type = doc.ResolveValueType(this.definition.Type);

            if (this.definition.DefaultValue is GraphQLParser.AST.GraphQLScalarValue sv)
            {
                this.DefaultValue = sv.Value;
            }
            else
            {
                this.DefaultValue = this.definition.DefaultValue?.ToString();
            }


            this.Type = doc.ResolveValueType(this.definition.Type);
        }
Esempio n. 10
0
        public void Resolve(GraphQLDocument doc)
        {
            if (this.Name == "__typename")
            {
                return;
            }

            if (this.definition != null)
            {
                this.Type = doc.ResolveValueType(this.definition.Type);
            }
            else if (this.definitionInput != null)
            {
                this.Type = doc.ResolveValueType(this.definitionInput.Type);
            }

            foreach (Argument a in this.Arguments)
            {
                a.Resolve(doc);
            }
        }
Esempio n. 11
0
        public void Resolve(GraphQLDocument doc)
        {
            if (this.definition != null)
            {
                this.Interfaces = ResolveInterfaces(doc).ToList();
                this.Fields     = this.definition.Fields.Select(x =>
                {
                    return(new Field(x));
                }).ToList();
            }
            else if (this.definitionInput != null)
            {
                this.Fields = this.definitionInput.Fields.Select(x =>
                {
                    return(new Field(x));
                }).ToList();
            }

            foreach (var f in this.Fields)
            {
                f.Resolve(doc);
            }
        }
Esempio n. 12
0
 public void Resolve(GraphQLDocument doc)
 {
 }
Esempio n. 13
0
 public void Resolve(GraphQLDocument doc)
 {
     this.Types = this.op.Types.Select(x => doc.ResolveType(x)).ToList();
 }