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

Adding defer to engine tests #521

Merged
merged 20 commits into from
Apr 24, 2024
Merged

Adding defer to engine tests #521

merged 20 commits into from
Apr 24, 2024

Conversation

sbarker2
Copy link
Collaborator

@sbarker2 sbarker2 commented Mar 6, 2024

this PR is to enable us to run engine tests for the @defer directive according to the graphql-spec

@@ -39,7 +40,7 @@ class RemoveFieldTestTransform : NadelTransform<GraphQLError> {
?: return null

if (objectType.getField(overallField.name)?.getDirective("toBeDeleted") != null) {
return ValidationError(ValidationErrorType.WrongType)
return newValidationError().validationErrorType(ValidationErrorType.WrongType).build()
Copy link
Collaborator Author

@sbarker2 sbarker2 Apr 15, 2024

Choose a reason for hiding this comment

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

Need to use builder here in latest graphql-java as @bbakerman removed the deprecated constructor

graphql-java/graphql-java@522a540

@sbarker2 sbarker2 marked this pull request as ready for review April 15, 2024 20:27
Comment on lines 215 to 220
.label(it["label"] as String)
.path(it["path"] as List<Object>)
.apply {
if (it["extensions"] != null) extensions(it["extensions"] as Map<Any, Any>)
if (it["errors"] != null) errors(it["errors"] as List<GraphQLError>)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sbarker2 sbarker2 self-assigned this Apr 16, 2024
@sbarker2 sbarker2 requested review from felipe-gdr and gnawf April 16, 2024 03:24
@gnawf
Copy link
Collaborator

gnawf commented Apr 16, 2024

Are we asserting the new incrementalResponse now or in another PR? Because that isn't happening here.

@sbarker2
Copy link
Collaborator Author

Are we asserting the new incrementalResponse now or in another PR? Because that isn't happening here.

the assertion will be in its own PR 👍

)
}
else if (serviceCall.incrementalResponse != null) {
fun transformData(executionResult: JsonMap): DelayedIncrementalPartialResult{
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this function needs a more specific name: transformDelayedIncrementalPartialResult or transformDelayed...
I'd also move its definition out of the getServiceExecution function for better readability.
The other transformation steps could also be extracted into their own functions: transformExecutionResult, transformIncrementalExecutionResult, etc.

# Conflicts:
#	test/src/test/kotlin/graphql/nadel/tests/EngineTests.kt
#	test/src/test/kotlin/graphql/nadel/tests/TestFixture.kt
#	test/src/test/resources/fixtures/defer/defer-with-label.yml
@sbarker2 sbarker2 merged commit bc0bf34 into master Apr 24, 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