File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
graphql_client_codegen/src/query Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,8 @@ pub(super) fn validate_typename_presence(
5
5
query : & BoundQuery < ' _ > ,
6
6
) -> Result < ( ) , QueryValidationError > {
7
7
for fragment in & query. query . fragments {
8
- let type_id = match fragment. on {
9
- id @ ( TypeId :: Interface ( _) | TypeId :: Union ( _) ) => id,
10
- _ => continue ,
8
+ let type_id @ ( TypeId :: Interface ( _) | TypeId :: Union ( _) ) = fragment. on else {
9
+ continue ;
11
10
} ;
12
11
13
12
if !selection_set_contains_type_name ( fragment. on , & fragment. selection_set , query. query ) {
@@ -23,14 +22,15 @@ pub(super) fn validate_typename_presence(
23
22
query
24
23
. query
25
24
. selections ( )
26
- . filter_map ( |( selection_id, selection) | match selection {
27
- Selection :: Field ( field) => match query. schema . get_field ( field. field_id ) . r#type . id {
28
- id @ ( TypeId :: Interface ( _) | TypeId :: Union ( _) ) => {
29
- Some ( ( selection_id, id, & field. selection_set ) )
25
+ . filter_map ( |( selection_id, selection) | {
26
+ if let Selection :: Field ( field) = selection {
27
+ let field_type_id = query. schema . get_field ( field. field_id ) . r#type . id ;
28
+
29
+ if matches ! ( field_type_id, TypeId :: Interface ( _) | TypeId :: Union ( _) ) {
30
+ return Some ( ( selection_id, field_type_id, & field. selection_set ) ) ;
30
31
}
31
- _ => None ,
32
- } ,
33
- _ => None ,
32
+ }
33
+ None
34
34
} ) ;
35
35
36
36
for selection in union_and_interface_field_selections {
You can’t perform that action at this time.
0 commit comments