Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL4 - resolve async write using System.Text.Json #11499

Merged
merged 2 commits into from
Apr 28, 2022

Conversation

MikeKry
Copy link
Contributor

@MikeKry MikeKry commented Apr 7, 2022

Replace newtonsoft.json with System.Text.Json to allow async write directly to response

handles - buffered stream issue from (#10782)

Replace newtonsoft.json with System.Text.Json to allow async write directly to response
@MikeKry
Copy link
Contributor Author

MikeKry commented Apr 7, 2022

I have resolved problem reported by @sebastienros in #9087

Info about newtonsoft vs system.text.json here: https://graphql-dotnet.github.io/docs/guides/serialization/

In case of updating to GraphQL5,

request = await JsonSerializer.DeserializeAsync<GraphQLRequest>(context.Request.Body, new JsonSerializerOptions { WriteIndented = false, PropertyNamingPolicy = JsonNamingPolicy.CamelCase });

and

_.Inputs = request.Variables.ToInputs();

can be replaced by IGraphQLSerializer

 var request = await _serializer.ReadAsync<GraphQLRequest>(context.Request.Body, context.RequestAborted);

Tested both post and get api.

@MikeKry MikeKry changed the title GraphQL4 GraphQL4 - resolve async write using System.Text.Json Apr 7, 2022
@sebastienros
Copy link
Member

I like it

@sebastienros sebastienros merged commit 098106b into OrchardCMS:ag/graphql4 Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants