Example #1
0
        private async Task <object> IntrospectSchemaIfRequested(
            FieldScope scope, IDictionary <string, IList <GraphQLFieldSelection> > fields)
        {
            if (fields.ContainsKey("__schema"))
            {
                var field = fields["__schema"].Single();
                fields.Remove("__schema");

                return(await scope.CompleteValue(
                           this.graphQLSchema.IntrospectedSchema,
                           this.graphQLSchema.IntrospectedSchema.GetType(),
                           field,
                           field.Arguments.ToList()));
            }

            return(null);
        }
Example #2
0
        private async Task <object> IntrospectTypeIfRequested(
            FieldScope scope, IDictionary <string, IList <GraphQLFieldSelection> > fields)
        {
            if (fields.ContainsKey("__type"))
            {
                var field = fields["__type"].Single();
                fields.Remove("__type");

                var value = await scope.InvokeWithArguments(
                    field.Arguments.ToList(),
                    this.GetTypeIntrospectionLambda());

                return(await scope.CompleteValue(
                           value,
                           value?.GetType(),
                           field,
                           field.Arguments.ToList()));
            }

            return(null);
        }