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

[READY] Initial defer implementation #553

Merged
merged 11 commits into from
Jun 29, 2024
Merged

Conversation

sbarker2
Copy link
Collaborator

Merging deferred results to publisher and send back to client (part of the defer implementation for non-hydrated queries)

NOTE: This does not apply the transformers yet - this work is in progress, but just note at this point, queries with transformers (for example renames) will not work.

@@ -126,11 +126,15 @@ abstract class NadelIntegrationTest(
// Maybe this won't hold out longer term, but e.g. it's ok for the deferred errors to add a path
assertJsonEquals(
Copy link
Collaborator Author

@sbarker2 sbarker2 Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is because we want to ignore the locations field in errors when comparing defer vs non-defer queries because the line/column of the error would be different as the two queries look slightly different (one has @defer directive stripped)

@sbarker2 sbarker2 changed the title Initial defer implementation [READY] Initial defer implementation Jun 26, 2024
import graphql.nadel.NadelExecutionHints
import graphql.nadel.tests.next.NadelIntegrationTest

open class DeferThrowsErrorTest : NadelIntegrationTest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between this test and DeferReturnsErrorTest ?

Copy link
Collaborator Author

@sbarker2 sbarker2 Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for DeferReturnsErrorTest I was meaning to return a DataFetcherResult with an error as that was the case that was failing before your change in graphql-java (graphql-java/graphql-java#3640).

I think I was supposed to do:

                           .dataFetcher("slow") { env ->
                                DataFetcherResult.newResult<String>()
                                    .error(
                                        GraphqlErrorBuilder.newError()
                                        .message("An error occurred while fetching 'slow'")
                                        .build()
                                    )
                                    .build()
                            }

I will delete DeferReturnsErrorTest for now and add in the new test later when we have updated graphql-java

Copy link
Contributor

@felipe-gdr felipe-gdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test coverage! I left some minor comments

@Juliano-Prado
Copy link

LGTM. Awesome test coverage Steven!

@sbarker2 sbarker2 merged commit 0d1d3cf into master Jun 29, 2024
2 checks passed
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.

3 participants