File tree Expand file tree Collapse file tree 5 files changed +82
-16
lines changed Expand file tree Collapse file tree 5 files changed +82
-16
lines changed Original file line number Diff line number Diff line change 1
1
root = true
2
2
3
- [* ]
3
+ [* .rs ]
4
4
end_of_line = lf
5
5
insert_final_newline = true
6
6
charset = utf-8
Original file line number Diff line number Diff line change @@ -79,3 +79,20 @@ fn interface_not_on_everything_deserialization() {
79
79
80
80
assert_eq ! ( response_data. everything. map( |names| names. len( ) ) , Some ( 4 ) ) ;
81
81
}
82
+
83
+ #[ derive( GraphQLQuery ) ]
84
+ #[ graphql(
85
+ query_path = "tests/interfaces/interface_with_fragment_query.graphql" ,
86
+ schema_path = "tests/interfaces/interface_schema.graphql" ,
87
+ response_derives = "Debug" ,
88
+ ) ]
89
+ pub struct InterfaceWithFragmentQuery ;
90
+
91
+ const RESPONSE_FRAGMENT : & ' static str =
92
+ include_str ! ( "interfaces/interface_with_fragment_response.json" ) ;
93
+
94
+ #[ test]
95
+ fn fragment_in_interface ( ) {
96
+ let response_data: interface_with_fragment_query:: ResponseData =
97
+ serde_json:: from_str ( RESPONSE_FRAGMENT ) . unwrap ( ) ;
98
+ }
Original file line number Diff line number Diff line change 1
1
schema {
2
- query : InterfaceQuery
2
+ query : InterfaceQuery
3
3
}
4
4
5
5
interface Named {
6
- name : String !
6
+ name : String !
7
+ displayName : Boolean !
7
8
}
8
9
9
10
type Person implements Named {
10
- name : String !
11
- birthday : String
11
+ name : String !
12
+ birthday : String
12
13
}
13
14
14
15
enum Industry {
15
- CHOCOLATE
16
- OTHER
16
+ CHOCOLATE
17
+ OTHER
17
18
}
18
19
19
20
type Organization implements Named {
20
- name : String
21
- industry : Industry !
22
- createdAt : String
21
+ name : String
22
+ industry : Industry !
23
+ createdAt : String
23
24
}
24
25
25
26
type Dog implements Named {
26
- name : String !
27
- """
28
- Always returns true
29
- """
30
- isGoodDog : Boolean !
27
+ name : String !
28
+ """
29
+ Always returns true
30
+ """
31
+ isGoodDog : Boolean !
31
32
}
32
33
33
34
type InterfaceQuery {
34
- everything : [Named ! ]
35
+ everything : [Named ! ]
35
36
}
Original file line number Diff line number Diff line change
1
+ fragment PublicStatus on Named {
2
+ displayName
3
+ }
4
+
5
+ query MyQuery {
6
+ everything {
7
+ name
8
+ __typename
9
+ ... PublicStatus
10
+ ... on Dog {
11
+ isGoodDog
12
+ }
13
+ ... on Person {
14
+ birthday
15
+ }
16
+ ... on Organization {
17
+ industry
18
+ }
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "everything" : [
3
+ {
4
+ "__typename" : " Person" ,
5
+ "name" : " Audrey Lorde" ,
6
+ "displayName" : false ,
7
+ "birthday" : " 1934-02-18"
8
+ },
9
+ {
10
+ "__typename" : " Dog" ,
11
+ "name" : " Laïka" ,
12
+ "displayName" : true ,
13
+ "isGoodDog" : true
14
+ },
15
+ {
16
+ "__typename" : " Organization" ,
17
+ "name" : " Mozilla" ,
18
+ "displayName" : false ,
19
+ "industry" : " OTHER"
20
+ },
21
+ {
22
+ "__typename" : " Dog" ,
23
+ "name" : " Norbert" ,
24
+ "displayName" : true ,
25
+ "isGoodDog" : true
26
+ }
27
+ ]
28
+ }
You can’t perform that action at this time.
0 commit comments