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

fix incremental partial result builder #3562

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public Builder incrementalItems(List<IncrementalPayload> incrementalItems) {
return this;
}

public Builder extensions(boolean hasNext) {
Copy link
Member

Choose a reason for hiding this comment

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

copy pasta bug I am guesing

this.hasNext = hasNext;
public Builder extensions(Map<Object, Object> extensions) {
this.extensions = extensions;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import static graphql.incremental.StreamPayload.newStreamedItem

class IncrementalExecutionResultTest extends Specification {

def "sanity test to check builders work"() {
def "sanity test to check IncrementalExecutionResultImpl builder and item builders work"() {
when:
def defer1 = newDeferredItem()
.label("homeWorldDefer")
Expand Down Expand Up @@ -40,13 +40,15 @@ class IncrementalExecutionResultTest extends Specification {
])
.hasNext(true)
.incremental([defer1, stream1, stream2])
.extensions([some: "map"])
Copy link
Contributor Author

@sbarker2 sbarker2 Apr 11, 2024

Choose a reason for hiding this comment

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

this is a similar extensions function test for another class that I've added as well

.build()

def toSpec = result.toSpecification()

then:
toSpec == [
data : [person: [name: "Luke Skywalker", films: [[title: "A New Hope"]]]],
extensions: [some: "map"],
hasNext : true,
incremental: [
[path: ["person"], label: "homeWorldDefer", data: [homeWorld: "Tatooine"]],
Expand All @@ -56,4 +58,28 @@ class IncrementalExecutionResultTest extends Specification {
]

}
def "sanity test to check DelayedIncrementalPartialResult builder works"() {
when:
def deferredItem = newDeferredItem()
.label("homeWorld")
.path(ResultPath.parse("/person"))
.data([homeWorld: "Tatooine"])
.build()

def result = DelayedIncrementalPartialResultImpl.newIncrementalExecutionResult()
.incrementalItems([deferredItem])
.hasNext(false)
.extensions([some: "map"])
.build()

def toSpec = result.toSpecification()

then:
toSpec == [
incremental: [[path: ["person"], label: "homeWorld", data: [homeWorld: "Tatooine"]]],
extensions: [some: "map"],
hasNext : false,
]

}
}