Skip to content

Commit ee924eb

Browse files
committed
test: add regression test for specifiedByURL on __Type
Verifies that specifiedByURL is queryable and returns null for built-in scalar types and object types, matching the GraphQL Oct 2021 spec.
1 parent fc21439 commit ee924eb

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
begin;
2+
comment on schema public is e'@graphql({"inflect_names": true, "introspection": true})';
3+
-- specifiedByURL should be queryable and return null for built-in scalars
4+
select graphql.resolve(
5+
query:='{ __type(name: "Boolean") { specifiedByURL } }'
6+
);
7+
resolve
8+
------------------------------------------------------------------
9+
{"data": {"__type": {"specifiedByURL": null}}}
10+
(1 row)
11+
12+
-- specifiedByURL should also work alongside other fields
13+
select graphql.resolve(
14+
query:='{ __type(name: "String") { name kind specifiedByURL } }'
15+
);
16+
resolve
17+
----------------------------------------------------------------------------------------------
18+
{"data": {"__type": {"kind": "SCALAR", "name": "String", "specifiedByURL": null}}}
19+
(1 row)
20+
21+
-- specifiedByURL on a non-scalar type (e.g. OBJECT) should also return null
22+
select graphql.resolve(
23+
query:='{ __type(name: "Query") { name kind specifiedByURL } }'
24+
);
25+
resolve
26+
---------------------------------------------------------------------------------------------
27+
{"data": {"__type": {"kind": "OBJECT", "name": "Query", "specifiedByURL": null}}}
28+
(1 row)
29+
30+
rollback;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
begin;
2+
comment on schema public is e'@graphql({"inflect_names": true, "introspection": true})';
3+
4+
-- specifiedByURL should be queryable and return null for built-in scalars
5+
select graphql.resolve(
6+
query:='{ __type(name: "Boolean") { specifiedByURL } }'
7+
);
8+
9+
-- specifiedByURL should also work alongside other fields
10+
select graphql.resolve(
11+
query:='{ __type(name: "String") { name kind specifiedByURL } }'
12+
);
13+
14+
-- specifiedByURL on a non-scalar type (e.g. OBJECT) should also return null
15+
select graphql.resolve(
16+
query:='{ __type(name: "Query") { name kind specifiedByURL } }'
17+
);
18+
19+
rollback;

0 commit comments

Comments
 (0)