-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add APQ support #555
Merged
Add APQ support #555
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9f842be
Add APQ support
sungam3r ed54915
changes
sungam3r 57920cd
rem
sungam3r b25557c
note
sungam3r 058d2e6
progress
sungam3r cf7c7c0
progress
sungam3r d199fce
fix variable name
rose-a bbdf13c
move APQ code to SendQueryAsync method to allow usage over websocket,…
rose-a 5429f64
make the APQDisabledForSession flag public (helps for testing)
rose-a 97312ee
create a test that uses the APQ feature
rose-a 77a6d7e
test APQ with websocket transport
rose-a 0b47264
move code for generation of the APQ extension into GraphQLRequest
rose-a 2b77d59
fix naming
rose-a 4fadbff
replace system.memory reference with narrower system.buffers reference
rose-a ddc0268
Update src/GraphQL.Primitives/GraphQLRequest.cs
rose-a 3f50777
Update src/GraphQL.Primitives/GraphQLRequest.cs
rose-a c8b6254
document APQ feature +semver: feature
rose-a 6be7d9c
optimize docs
rose-a File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=APQ/@EntryIndexedValue">APQ</s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QL/@EntryIndexedValue">QL</s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
#if NET6_0_OR_GREATER | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace GraphQL; | ||
|
||
/// <summary> | ||
/// Value record for a GraphQL query string | ||
/// Value object representing a GraphQL query string and storing the corresponding APQ hash. <br /> | ||
/// Use this to hold query strings you want to use more than once. | ||
/// </summary> | ||
/// <param name="Text">the actual query string</param> | ||
public readonly record struct GraphQLQuery([StringSyntax("GraphQL")] string Text) | ||
public class GraphQLQuery : IEquatable<GraphQLQuery> | ||
rose-a marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
/// <summary> | ||
/// The actual query string | ||
/// </summary> | ||
public string Text { get; } | ||
|
||
/// <summary> | ||
/// The SHA256 hash used for the automatic persisted queries feature (APQ) | ||
/// </summary> | ||
public string Sha256Hash { get; } | ||
|
||
public GraphQLQuery([StringSyntax("GraphQL")] string text) | ||
{ | ||
Text = text; | ||
Sha256Hash = Hash.Compute(Text); | ||
} | ||
|
||
public static implicit operator string(GraphQLQuery query) | ||
=> query.Text; | ||
}; | ||
#endif | ||
|
||
public bool Equals(GraphQLQuery other) => Sha256Hash == other.Sha256Hash; | ||
|
||
public override bool Equals(object? obj) => obj is GraphQLQuery other && Equals(other); | ||
|
||
public override int GetHashCode() => Sha256Hash.GetHashCode(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface is needed to pass non-generic instance of response into
GraphQLHttpClientOptions.DisableAPQ
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should put the content in there, too... then people can evaluate plaintext error messages...
Always having the raw content in there might be beneficial for general debugging, too, cause then people could cast their responses to
IGraphQLHttpResponse
and get the raw body of the response...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I would put entire
HttpResponseMessage
instead of pulling discrete properties from it. Also note that content may be already unaccessable since stream was read inSendHttpRequestAsync
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#559 , not a goal for this PR