-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support null query when running APQ request #4049
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
Conversation
…g APQ request Support null query when running APQ request Full issue described in graphql-java#4008 ---- #### AI description (iteration 1) #### PR Classification Bug fix: Enhance ExecutionInput to properly handle null queries in automatic persisted query (APQ) requests. #### PR Summary This pull request modifies the ExecutionInput logic to return a persisted query marker when a null or empty query is provided along with a persistedQuery extension, ensuring graceful handling of APQ requests. - `src/main/java/graphql/ExecutionInput.java`: Introduces a new static method (`assertQuery`) to check for null/empty queries and returns a persisted query marker if appropriate; also removes the strict non-null assertion in the builder. - `src/test/groovy/graphql/ExecutionInputTest.groovy`: Adds a test case validating that a null query with the persistedQuery extension returns the expected persisted query marker. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #355548 # Conflicts: # src/test/groovy/graphql/ExecutionInputTest.groovy
Hello wanted to say, thanks so much for yet another PR! Thanks for all your time and effort |
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.
Lets decide on the API shape - specific method or extension entry ??
def "uses persisted query marker when query is empty and extensions contains persistedQuery"() { | ||
when: | ||
def executionInput = ExecutionInput.newExecutionInput() | ||
.extensions([persistedQuery: "any"]) |
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.
So the question then is
should we provide a helper builder method (that sets the query for you to the magic value) or use a "map entry" in extentions.
I feel like the former is better but would love to why you chose "extensions" - was there a client reason ?
Lets not do this in this PQ as suggested - I misundertood the problem being solved |
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 approve but I would love to see the constant and comment suggestion actioned
def "uses persisted query marker when query is empty and extensions contains persistedQuery"() { | ||
when: | ||
def executionInput = ExecutionInput.newExecutionInput() | ||
.extensions([persistedQuery: "any"]) |
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.
And hence to this code - leave it as it is
Applied suggestions. |
…matic Persisted Query support
private static boolean isPersistedQuery(Builder builder) { | ||
return builder.extensions != null && | ||
builder.extensions.containsKey(APOLLO_AUTOMATIC_PERSISTED_QUERY_EXTENSION); | ||
} |
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.
Nice code
Support null query when running APQ request. This is upstream merge of our commit made by @joshjcarrier
#4008
This pull request modifies the ExecutionInput logic to return a persisted query marker when a null or empty query is provided along with a persistedQuery extension, ensuring graceful handling of APQ requests.
src/main/java/graphql/ExecutionInput.java
: Introduces a new static method (assertQuery
) to check for null/empty queries and returns a persisted query marker if appropriate; also removes the strict non-null assertion in the builder.src/test/groovy/graphql/ExecutionInputTest.groovy
: Adds a test case validating that a null query with the persistedQuery extension returns the expected persisted query marker.