Questions tagged [graphql-dotnet]

Use for the GraphQL .NET project.

Tag for the GraphQL .NET project.

https://github.com/graphql-dotnet/graphql-dotnet

105 questions
20
votes
5 answers

EF Core with GraphQL

I'm currently exploring the GraphQL development and I'm currently exploring what kind of SQL queries are Generated via EF Core and I observed that no matter that my GraphQL query includes only a few fields the EF Core sends SQL Select for all fields…
18
votes
1 answer

In GraphQL .NET, how do I specify that a query can take optional parameters?

Let's say I want to be able to query for a user by specifying their ID, or by specifying some other identifier, like email address. How do you construct the root Query object to accept that? Given this public class MyQuery : ObjectGraphType { …
Dylan Cristy
  • 916
  • 11
  • 29
9
votes
2 answers

Enable Synchronous IO in Azure Function

I am building a HTTPTriggered Azure Function, targeting netcoreapp3.0, that is running a GraphQL .NET server. GraphQL .NET requires that AllowSynchronousIO is set to true, but I can't figure out how to do that for a Azure Function. I have tried…
Ganhammar
  • 1,871
  • 1
  • 16
  • 29
8
votes
3 answers

Converting .NET Enum to GraphQL EnumerationGraphType

How do I convert an enum to the EnumerationGraphType that GraphQL uses? Here is an example to illustrate what I'm talking about: public enum MeetingStatusType { Tentative, Unconfirmed, Confirmed, } public class MeetingDto { public…
Daric
  • 440
  • 1
  • 4
  • 12
7
votes
2 answers

How to implement authorization using GraphQL.NET at Resolver function level?

I am looking for sample code and examples regarding how to implement authorization at resolver function level using GraphQL.NET and ASP.NET CORE 2. Basically I am trying to prevent the execution of query if the request is not authorized. Can anyone…
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
6
votes
2 answers

How to handle concurrent DbContext access in dataloaders / GraphQL nested queries?

I'm using a couple of dataloaders that use injected query services (which in turn have dependencies on a DbContext). It looks something like this: Field>( "Users", resolve: context => { var loader =…
6
votes
1 answer

GraphQL.NET mutation with a List> | JSON string

I want to register alarms on my server application. To prevent passing 10+ arguments, I serialize my alarm on client side and pass it as List to my server. Deserialize it, register it and give the answer of an registered alarm. Now my…
Dominic Jonas
  • 4,717
  • 1
  • 34
  • 77
6
votes
2 answers

File Upload with Relay and graphql-dotnet

I'm trying to build a mutation within relay that includes a file. As soon as I implement the getFiles() method referenced here: https://facebook.github.io/relay/docs/api-reference-relay-mutation.html#getfiles Relay sends a multipart request causing…
Jon Lebensold
  • 339
  • 3
  • 10
5
votes
3 answers

Some services are not able to be constructed using the library : NetCore.AutoRegisterDi

I am developing asp.net core 3.1 GraphQL based APIs. I used the below reference article to setup automatic DI configuration in the API layer and have used the nuget package :…
5
votes
2 answers

GraphQL authentication with Asp.net core using JWT

I am using for GraphQL for .NET package for graphql. But I couldn't understand how can I authentication with JWT in graphql query or mutation. I read the guide about authorization but I couldn't accomplish. I need help with GraphQL for .NET…
tcetin
  • 979
  • 1
  • 21
  • 48
5
votes
0 answers

Having a field of JSON dictionary on input type for mutation

I am trying to create a mutation that takes an input type FooInputType. My problem is having a field on that input to represent a JSON dictionary(string-string). for example, foo.tags field could have any set of key-value pairs of type…
Poulad
  • 1,149
  • 1
  • 12
  • 22
4
votes
1 answer

How does one organize more than a few mutations in GraphQL .Net GraphType First?

In GraphQL .Net most of the example code has one top level mutations graph object that has many actual mutations defined within it. Here's an example from the GraphQL .NET mutations page: public class StarWarsSchema : Schema { public…
Mark Rogers
  • 96,497
  • 18
  • 85
  • 138
4
votes
1 answer

Could not load type 'GraphQL.Http.IDocumentWriter' from assembly 'GraphQL, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'

The error happens when it reaches services.AddGraphQL. I tried downgrading the version of GraphQL to 2.4 but then FuncServiceProvider stops working. Here's what I have: MarketScheme.cs public class MarketScheme : Schema { public…
Speedy
  • 69
  • 8
4
votes
1 answer

Is it possible in GraphQL to send an Enum with multiple values

In C# it's possible to create an Enum with a Flags Attribute.(https://learn.microsoft.com/en-us/dotnet/api/system.flagsattribute?view=netstandard-2.1) This means that that an Enum can look like this: [Flags] enum EnumWithFlags { None = 0, …
user8689373
  • 115
  • 1
  • 11
4
votes
2 answers

Why is graphql-dotnet returning "Expected non-null value" error for this schema?

I have a simple schema that I'm trying to query as follows: { subQuery { subObjectGraph { Name } } } But "graphiql" throws the following error, without even seeming to run my query. { "errors": [ { "message":…
willem
  • 25,977
  • 22
  • 75
  • 115
1
2 3 4 5 6 7