Commit d87dffd
committed
Return null values from Connection visitor when expected
Prior to this commit, a schema declaring a `BookConnection` nullable
type would decorate the relevant data fetcher and return an
`EMPTY_CONNECTION` value (a full Connection instance with empty nodes
and edges) if the original DataFetcher returns `null`.
This is unexpected for applications because the type is declared as
nullable in the schema and the application returns a `null` value.
This commit ensures that `EMPTY_CONNECTION` is only returned as a value
if the Connection type is marked as non nullable, `BookConnection!`.
This change should only affect applications with custom pagination
support, as Spring Data never returns `null` for empty pages.
Closes gh-12951 parent b8e7a95 commit d87dffd
File tree
2 files changed
+37
-7
lines changed- spring-graphql/src
- main/java/org/springframework/graphql/data/pagination
- test/java/org/springframework/graphql/data/pagination
2 files changed
+37
-7
lines changedLines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | | - | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
193 | | - | |
| 194 | + | |
194 | 195 | | |
| 196 | + | |
195 | 197 | | |
196 | | - | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| |||
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
| 207 | + | |
205 | 208 | | |
206 | 209 | | |
207 | 210 | | |
| |||
232 | 235 | | |
233 | 236 | | |
234 | 237 | | |
235 | | - | |
| 238 | + | |
236 | 239 | | |
237 | | - | |
| 240 | + | |
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
| |||
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
271 | 281 | | |
272 | 282 | | |
273 | 283 | | |
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
| 140 | + | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
149 | 169 | | |
150 | 170 | | |
151 | 171 | | |
| |||
0 commit comments