Skip to content

Commit 7951d27

Browse files
authored
Merge pull request #612 from timkendrick/non-null-collection-type
2 parents 9cf4882 + 063f49b commit 7951d27

File tree

6 files changed

+78
-20
lines changed

6 files changed

+78
-20
lines changed

src/graphql.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,9 @@ impl ___Type for QueryType {
12341234

12351235
let collection_entrypoint = __Field {
12361236
name_: format!("{}Collection", lowercase_first_letter(table_base_type_name)),
1237-
type_: __Type::Connection(connection_type),
1237+
type_: __Type::NonNull(NonNullType {
1238+
type_: Box::new(__Type::Connection(connection_type)),
1239+
}),
12381240
args: connection_args,
12391241
description: Some(format!(
12401242
"A pagable collection of type `{}`",

test/expected/function_calls.out

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,11 @@ begin;
20212021
description
20222022
type {
20232023
kind
2024+
name
2025+
ofType {
2026+
kind
2027+
name
2028+
}
20242029
}
20252030
args {
20262031
name
@@ -2108,7 +2113,12 @@ begin;
21082113
], +
21092114
"name": "accountCollection", +
21102115
"type": { +
2111-
"kind": "OBJECT" +
2116+
"kind": "NON_NULL", +
2117+
"name": null, +
2118+
"ofType": { +
2119+
"kind": "OBJECT", +
2120+
"name": "AccountConnection" +
2121+
} +
21122122
}, +
21132123
"description": "A pagable collection of type `Account`"+
21142124
}, +
@@ -2128,7 +2138,9 @@ begin;
21282138
], +
21292139
"name": "node", +
21302140
"type": { +
2131-
"kind": "INTERFACE" +
2141+
"kind": "INTERFACE", +
2142+
"name": "Node", +
2143+
"ofType": null +
21322144
}, +
21332145
"description": "Retrieve a record by its `ID`" +
21342146
}, +
@@ -2137,7 +2149,9 @@ begin;
21372149
], +
21382150
"name": "returnsAccount", +
21392151
"type": { +
2140-
"kind": "OBJECT" +
2152+
"kind": "OBJECT", +
2153+
"name": "Account", +
2154+
"ofType": null +
21412155
}, +
21422156
"description": null +
21432157
}, +
@@ -2157,7 +2171,9 @@ begin;
21572171
], +
21582172
"name": "returnsAccountWithId", +
21592173
"type": { +
2160-
"kind": "OBJECT" +
2174+
"kind": "OBJECT", +
2175+
"name": "Account", +
2176+
"ofType": null +
21612177
}, +
21622178
"description": null +
21632179
}, +
@@ -2236,7 +2252,9 @@ begin;
22362252
], +
22372253
"name": "returnsSetofAccount", +
22382254
"type": { +
2239-
"kind": "OBJECT" +
2255+
"kind": "OBJECT", +
2256+
"name": "AccountConnection", +
2257+
"ofType": null +
22402258
}, +
22412259
"description": null +
22422260
} +

test/expected/function_calls_unsupported.out

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ begin;
292292
description
293293
type {
294294
kind
295+
name
296+
ofType {
297+
kind
298+
name
299+
}
295300
}
296301
args {
297302
name
@@ -357,7 +362,12 @@ begin;
357362
], +
358363
"name": "accountCollection", +
359364
"type": { +
360-
"kind": "OBJECT" +
365+
"kind": "NON_NULL", +
366+
"name": null, +
367+
"ofType": { +
368+
"kind": "OBJECT", +
369+
"name": "AccountConnection" +
370+
} +
361371
}, +
362372
"description": "A pagable collection of type `Account`"+
363373
}, +
@@ -372,7 +382,9 @@ begin;
372382
], +
373383
"name": "node", +
374384
"type": { +
375-
"kind": "INTERFACE" +
385+
"kind": "INTERFACE", +
386+
"name": "Node", +
387+
"ofType": null +
376388
}, +
377389
"description": "Retrieve a record by its `ID`" +
378390
} +

0 commit comments

Comments
 (0)