Beispiel #1
0
        internal bool Resolve(GraphQLDocument doc, IGraphQLFieldCollection rootType)
        {
            if (this.op.Name.Value == "__typename")
            {
                // special case here
                this.Type = Field.TypeName(doc);
            }
            else
            {
                // this is special we need to treat it as such
                this.Type = rootType.Fields.SingleOrDefault(x => x.Name == this.op.Name.Value);
                if (this.Type == null)
                {
                    doc.AddError(ErrorCodes.UnknownField, $"The field '{this.op.Name.Value}' in not a valid member of '{rootType.Name}'", this.op);
                    return(false);
                }
            }
            if (this.Selection != null)
            {
                IGraphQLType root = this.Type.Type.Type as IGraphQLType;

                var specifiedTypeName = doc.ResolveSpecifiedTypeName(this.op);
                this.Selection.Resolve(doc, root, specifiedTypeName);
            }

            //if (selection != null)
            //{
            //    // if we have subselction then it must be an object type really, unless an interface will work instead ???
            //    selection.Resolve(FieldType.Type.Type as IGraphQLFieldCollection);
            //}
            return(true);
        }
Beispiel #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);
 }
Beispiel #3
0
        public void Resolve(GraphQLDocument doc)
        {
            this.Paramaters = this.operation.VariableDefinitions?.ToDictionary(x => x.Variable.Name.Value, x => doc.ResolveValueType(x.Type)) ?? new Dictionary <string, ValueTypeReference>();

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

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

            this.Selection.Resolve(doc, rootType);
        }
        internal void Resolve(GraphQLDocument doc, IGraphQLFieldCollection rootType)
        {
            if (op.Name.Value == "__typename")
            {
                // special case here
                Type = Field.TypeName(doc);
            }
            else
            {
                // this is special we need to treat it as such
                Type = rootType.Fields.Single(x => x.Name == op.Name.Value);
            }
            if (Selection != null)
            {
                var root = Type.Type.Type as IGraphQLType;
                Selection.Resolve(doc, root);
            }

            //if(selection != null)
            //{
            //    // if we have subselction then it must be an object type really, unless an interface will work instead ???
            //    selection.Resolve(FieldType.Type.Type as IGraphQLFieldCollection);
            //}
        }
Beispiel #5
0
 internal void Resolve(IGraphQLFieldCollection rootType)
 {
 }