graphql-dotnet | GraphQL .NET - GraphQL | GraphQL library
kandi X-RAY | graphql-dotnet Summary
kandi X-RAY | graphql-dotnet Summary
GraphQL for .NET
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of graphql-dotnet
graphql-dotnet Key Features
graphql-dotnet Examples and Code Snippets
Community Discussions
Trending Discussions on graphql-dotnet
QUESTION
I have a service which will now consume a GraphQL API just to return an image URL for a front-end application.
This is my first time using GraphQL at all, and this is the query structure I must use:
...ANSWER
Answered 2022-Jan-28 at 16:32Run your query somewhere where you can grab the json result, copy it into the clipboard, then in VS, Edit/Paste Special/Paste JSON as classes.
Or use on of the many JSON to C# converters online, such as https://json2csharp.com/
That will give you the C# classes ready to use in your SendQueryAsync<>.
QUESTION
Cannot get this to run. I get the following error message, I have made it as simple as possible but what required service am I missing.
I am using the Graph Type first approach. https://graphql-dotnet.github.io/docs/getting-started/introduction
...System.InvalidOperationException: Required service for type autumn.TestOGT not found at GraphQL.Utilities.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) in //src/GraphQL/Utilities/ServiceProviderExtensions.cs:line 33 at GraphQL.Types.SchemaTypes.<>c__DisplayClass7_0.<.ctor>b__2(Type t) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 141 at GraphQL.Types.SchemaTypes.AddTypeIfNotRegistered(Type type, TypeCollectionContext context) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 539 at GraphQL.Types.SchemaTypes.HandleField(IComplexGraphType parentType, FieldType field, TypeCollectionContext context, Boolean applyNameConverter) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 429 at GraphQL.Types.SchemaTypes.AddType(IGraphType type, TypeCollectionContext context) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 333 at GraphQL.Types.SchemaTypes..ctor(ISchema schema, IServiceProvider serviceProvider) in //src/GraphQL/Types/Collections/SchemaTypes.cs:line 154 at GraphQL.Types.Schema.CreateSchemaTypes() in //src/GraphQL/Types/Schema.cs:line 328 at GraphQL.Types.Schema.Initialize() in //src/GraphQL/Types/Schema.cs:line 102 at GraphQL.Utilities.SchemaPrinter.PrintFilteredSchema(Func
2 directiveFilter, Func
2 typeFilter) in //src/GraphQL/Utilities/SchemaPrinter.cs:line 79 at GraphQL.Utilities.SchemaPrinter.Print() in //src/GraphQL/Utilities/SchemaPrinter.cs:line 63 at Autumn.Api.Controllers.AutumnController.Schema() in C:\ws\Autumn-APICore\Autumn.Api\Controllers\AutumnController.cs:line 37 at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
ANSWER
Answered 2021-Aug-11 at 13:50Error is AutumnQuery is not needed and had int the constructor IServiceProvider
QUESTION
I tried to write mutation but it gives me error.
as {"errors":[{"message":"Syntax Error: Expected $, found Name \"objects\"","locations":[{"line":2,"column":27}],"extensions":{"code":"GRAPHQL_PARSE_FAILED"}}]}
The code I wrote is this.
ANSWER
Answered 2021-Jun-06 at 14:15The problem with the example is the data type which is written that is hard to follow PersonAndFilms($id: ID)
now ID is a data type so I was assuming that it was just a variable name declared that's why I was in confusion.
So I had written it as query insert_users(objects: { name: $name, rocket: $rocket })
which was not understandable for GraphQL as it requires Data Type, so I re-writed my query as below.
QUESTION
Good morning.
I am a bit confused about these two repositories(graphql-dotnet/graphql-dotnet/
and graphql-dotnet/server/
).
https://github.com/graphql-dotnet/graphql-dotnet/ and https://github.com/graphql-dotnet/server
They are both under the same organization and there is some overlap of contributors, but I'm a bit lost about deciding which one to use.
I would like to build a dotnet 5 application that hosts a graphql endpoint. In a nutshell that is my goal.
I noticed that the graphql-dotnet/server/
repository has inbuilt some helpers such as.
ANSWER
Answered 2021-Mar-29 at 13:23The main graphql-dotnet repo is the "core" library of GraphQL components. The server repo contains ASP.NET specific extensions. It uses the core library. If you use the server project, you are also using the core library.
GraphQL itself can be used with any protocol, it is not required to be used with HTTP or JSON. So the core library does not have any HTTP or ASP.NET dependencies.
If you are using ASP.NET, then the server project is the quickest way to get started. If you want to use Subscriptions, then the server project provides that functionality.
If you don't need subscriptions and if you want a bit more control over how the framework handles the HTTP request, then it would be easier to write your own controller or middleware.
Using JWT authentication is handled by ASP.NET and can be used in either scenario. Federation can also be used in either scenario.
QUESTION
We are sending additional payload during connection_init (connectionParams in https://github.com/apollographql/subscriptions-transport-ws for Apollo).
I was unable to find any information on how to extract such information nor any kind of information on any message middlewares/handlers in the official sources.
Concurrent solution graphql-dotnet allows me to implement IOperationMessageListener like this
...ANSWER
Answered 2021-Jan-21 at 08:10What you are looking for is the ISocketSessionInterceptor
QUESTION
I am using GraphQL .net to respond to graphql queries on the backend of an Asp.net Core website. All the cookies seem to be passed with the requests but for some reason my graphql.net requests do not have the proper user session set on the HttpContext. The ClaimPrincipal is mostly empty via graphql.net while my Asp.net Core WebApi/Mvc style endpoints have the correct principal with user id even though both GraphQl.Net requests and non-graphql.net requests are happening at the same time.
I checked the payload and all the same cookies are passed in both requests. So it makes me wonder why are my regular WebApi endpoints able to (auto-magically) get the claims principal and why can't the graph.net endpoints do the same. As far as I know from previous usages of GraphQl.net I wasn't aware that any special session code had to be added (other than passing the user from the HttpContext to graphQL.net). I've been reading through GraphQL.Net and Asp.net core source code and docs, but so far I haven't found any obvious offenses or leads.
What might cause some issue like this? what are some common causes? Should I just try to figure out how to manually read in the cookie to Asp.net core and pull the principal?
Perhaps I'm missing a special header value? I don't think the headers are weird but I haven't done a side by side comparison between the headers in graphql.net and asp.net core requests.
In this snippet is where I first detect a problem. If I put a breakpoint here then the claimsprinical isn't correctly set for the current user session. And also later when I access the HttpContext the user session is not correct for graphql.net requests.
...ANSWER
Answered 2020-Nov-30 at 21:56What does your Configure
method look like? Is your app.UseAuthentication()
before your GraphQL middleware configuration?
QUESTION
I am following the sample on https://github.com/graphql-dotnet/server to create a GraphQL but I am getting the above error (Full version Below) when going to my http://localhost:5001/graphql.
I have played around with Many aspects of asp.core DependencyInjections but it still comes back to this error:
...ANSWER
Answered 2020-Nov-18 at 09:38https://github.com/graphql-dotnet/server/issues/454
The issue was I was trying to create a service for the type, And I should have just created it for my class I.E
QUESTION
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:
ANSWER
Answered 2020-Nov-09 at 17:14https://graphql-dotnet.github.io/docs/getting-started/query-organization
You can "group" queries or mutations together by adding a top level field. The "trick" is to return an empty object in the resolver.
QUESTION
I'm trying to send a GraphQL Request using This GraphQL Library.
When I attempt to send the GraphQLRequest
with some variables attached I get the following error,Variable $max is used by but not declared
.
ANSWER
Answered 2020-Oct-11 at 01:25You need to define the variable in the top level query before you can use it inside the query body.
QUESTION
I have a Dotnetcore 3.0 project (Project1) calling another Dotnetcore 3.0 project (Project2) at Graphql endpoints using graphql-dotnet library
Project2 is working fine and as expected and only returning a "data" object when being hit from either GraphiQL or postman. But when get the value from Project1 calling Project2 for the data I get an object response like this
...ANSWER
Answered 2020-Aug-17 at 00:17Thanks to Xadam for the response. Read the docs!
Fixed by setting this on the controller
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install graphql-dotnet
You can see the changes in public APIs using fuget.org.
3.x to 4.x
2.4.x to 3.x
0.17.x to 2.x
0.11.0
0.8.0
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page