Skip to content

Commit 303ed67

Browse files
authored
Merge pull request #501 from jimmystewpot/oneOf_support_in_introspection_query
extend introspection schema to include oneOf and specifiedByURL
2 parents 9b91a7f + de796b3 commit 303ed67

9 files changed

+402
-17
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
query IntrospectionQueryWithIsOneOfSpecifiedByURL {
2+
__schema {
3+
queryType {
4+
name
5+
}
6+
mutationType {
7+
name
8+
}
9+
subscriptionType {
10+
name
11+
}
12+
types {
13+
...FullTypeWithisOneOfSpecifiedByURL
14+
}
15+
directives {
16+
name
17+
description
18+
locations
19+
args {
20+
...InputValue
21+
}
22+
}
23+
}
24+
}
25+
26+
fragment FullTypeWithisOneOfSpecifiedByURL on __Type {
27+
kind
28+
name
29+
description
30+
isOneOf
31+
specifiedByURL
32+
fields(includeDeprecated: true) {
33+
name
34+
description
35+
args {
36+
...InputValue
37+
}
38+
type {
39+
...TypeRef
40+
}
41+
isDeprecated
42+
deprecationReason
43+
}
44+
inputFields {
45+
...InputValue
46+
}
47+
interfaces {
48+
...TypeRef
49+
}
50+
enumValues(includeDeprecated: true) {
51+
name
52+
description
53+
isDeprecated
54+
deprecationReason
55+
}
56+
possibleTypes {
57+
...TypeRef
58+
}
59+
}
60+
61+
fragment InputValue on __InputValue {
62+
name
63+
description
64+
type {
65+
...TypeRef
66+
}
67+
defaultValue
68+
}
69+
70+
fragment TypeRef on __Type {
71+
kind
72+
name
73+
ofType {
74+
kind
75+
name
76+
ofType {
77+
kind
78+
name
79+
ofType {
80+
kind
81+
name
82+
ofType {
83+
kind
84+
name
85+
ofType {
86+
kind
87+
name
88+
ofType {
89+
kind
90+
name
91+
ofType {
92+
kind
93+
name
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
}
101+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
query IntrospectionQueryWithIsOneOf {
2+
__schema {
3+
queryType {
4+
name
5+
}
6+
mutationType {
7+
name
8+
}
9+
subscriptionType {
10+
name
11+
}
12+
types {
13+
...FullTypeWithisOneOf
14+
}
15+
directives {
16+
name
17+
description
18+
locations
19+
args {
20+
...InputValue
21+
}
22+
}
23+
}
24+
}
25+
26+
fragment FullTypeWithisOneOf on __Type {
27+
kind
28+
name
29+
description
30+
isOneOf
31+
fields(includeDeprecated: true) {
32+
name
33+
description
34+
args {
35+
...InputValue
36+
}
37+
type {
38+
...TypeRef
39+
}
40+
isDeprecated
41+
deprecationReason
42+
}
43+
inputFields {
44+
...InputValue
45+
}
46+
interfaces {
47+
...TypeRef
48+
}
49+
enumValues(includeDeprecated: true) {
50+
name
51+
description
52+
isDeprecated
53+
deprecationReason
54+
}
55+
possibleTypes {
56+
...TypeRef
57+
}
58+
}
59+
60+
fragment InputValue on __InputValue {
61+
name
62+
description
63+
type {
64+
...TypeRef
65+
}
66+
defaultValue
67+
}
68+
69+
fragment TypeRef on __Type {
70+
kind
71+
name
72+
ofType {
73+
kind
74+
name
75+
ofType {
76+
kind
77+
name
78+
ofType {
79+
kind
80+
name
81+
ofType {
82+
kind
83+
name
84+
ofType {
85+
kind
86+
name
87+
ofType {
88+
kind
89+
name
90+
ofType {
91+
kind
92+
name
93+
}
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
query IntrospectionQueryWithSpecifiedBy {
2+
__schema {
3+
queryType {
4+
name
5+
}
6+
mutationType {
7+
name
8+
}
9+
subscriptionType {
10+
name
11+
}
12+
types {
13+
...FullTypeWithSpecifiedBy
14+
}
15+
directives {
16+
name
17+
description
18+
locations
19+
args {
20+
...InputValue
21+
}
22+
}
23+
}
24+
}
25+
26+
fragment FullTypeWithSpecifiedBy on __Type {
27+
kind
28+
name
29+
description
30+
specifiedByURL
31+
fields(includeDeprecated: true) {
32+
name
33+
description
34+
args {
35+
...InputValue
36+
}
37+
type {
38+
...TypeRef
39+
}
40+
isDeprecated
41+
deprecationReason
42+
}
43+
inputFields {
44+
...InputValue
45+
}
46+
interfaces {
47+
...TypeRef
48+
}
49+
enumValues(includeDeprecated: true) {
50+
name
51+
description
52+
isDeprecated
53+
deprecationReason
54+
}
55+
possibleTypes {
56+
...TypeRef
57+
}
58+
}
59+
60+
fragment InputValue on __InputValue {
61+
name
62+
description
63+
type {
64+
...TypeRef
65+
}
66+
defaultValue
67+
}
68+
69+
fragment TypeRef on __Type {
70+
kind
71+
name
72+
ofType {
73+
kind
74+
name
75+
ofType {
76+
kind
77+
name
78+
ofType {
79+
kind
80+
name
81+
ofType {
82+
kind
83+
name
84+
ofType {
85+
kind
86+
name
87+
ofType {
88+
kind
89+
name
90+
ofType {
91+
kind
92+
name
93+
}
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
}

graphql_client_cli/src/graphql/introspection_schema.graphql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ type __Type {
3636

3737
# NON_NULL and LIST only
3838
ofType: __Type
39+
40+
# may be non-null for custom SCALAR, otherwise null.
41+
# https://spec.graphql.org/draft/#sec-Scalars.Custom-Scalars
42+
specifiedByURL: String
43+
specifiedBy: String
44+
45+
# should be non-null for INPUT_OBJECT only
46+
isOneOf: Boolean
3947
}
4048

4149
type __Field {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use graphql_client::GraphQLQuery;
2+
3+
#[derive(GraphQLQuery)]
4+
#[graphql(
5+
schema_path = "src/graphql/introspection_schema.graphql",
6+
query_path = "src/graphql/introspection_query.graphql",
7+
response_derives = "Serialize",
8+
variable_derives = "Deserialize"
9+
)]
10+
#[allow(dead_code)]
11+
pub struct IntrospectionQuery;
12+
13+
#[derive(GraphQLQuery)]
14+
#[graphql(
15+
schema_path = "src/graphql/introspection_schema.graphql",
16+
query_path = "src/graphql/introspection_query_with_is_one_of.graphql",
17+
response_derives = "Serialize",
18+
variable_derives = "Deserialize"
19+
)]
20+
#[allow(dead_code)]
21+
pub struct IntrospectionQueryWithIsOneOf;
22+
23+
#[derive(GraphQLQuery)]
24+
#[graphql(
25+
schema_path = "src/graphql/introspection_schema.graphql",
26+
query_path = "src/graphql/introspection_query_with_specified_by.graphql",
27+
response_derives = "Serialize",
28+
variable_derives = "Deserialize"
29+
)]
30+
#[allow(dead_code)]
31+
pub struct IntrospectionQueryWithSpecifiedBy;
32+
33+
#[derive(GraphQLQuery)]
34+
#[graphql(
35+
schema_path = "src/graphql/introspection_schema.graphql",
36+
query_path = "src/graphql/introspection_query_with_isOneOf_specifiedByUrl.graphql",
37+
response_derives = "Serialize",
38+
variable_derives = "Deserialize"
39+
)]
40+
#[allow(dead_code)]
41+
pub struct IntrospectionQueryWithIsOneOfSpecifiedByURL;

0 commit comments

Comments
 (0)