@@ -10,29 +10,29 @@ type GraphQLDocument = String;
10
10
// The paths are relative to the directory where your `Cargo.toml` is located.
11
11
// Both json and the GraphQL schema language are supported as sources for the schema
12
12
#[ graphql(
13
- query_path = "src/query/schema/get .graphql" ,
13
+ query_path = "src/query/graph/fetch .graphql" ,
14
14
schema_path = ".schema/schema.graphql" ,
15
15
response_derives = "PartialEq, Debug, Serialize, Deserialize" ,
16
16
deprecated = "warn"
17
17
) ]
18
18
/// This struct is used to generate the module containing `Variables` and
19
19
/// `ResponseData` structs.
20
- /// Snake case of this name is the mod name. i.e. get_schema_query
21
- pub struct GetSchemaQuery ;
20
+ /// Snake case of this name is the mod name. i.e. fetch_schema_query
21
+ pub struct FetchSchemaQuery ;
22
22
23
23
/// The main function to be used from this module. This function fetches a
24
24
/// schema from apollo studio and returns it in either sdl (default) or json format
25
25
pub fn run (
26
- variables : get_schema_query :: Variables ,
26
+ variables : fetch_schema_query :: Variables ,
27
27
client : & StudioClient ,
28
28
) -> Result < String , RoverClientError > {
29
- let response_data = client. post :: < GetSchemaQuery > ( variables) ?;
29
+ let response_data = client. post :: < FetchSchemaQuery > ( variables) ?;
30
30
get_schema_from_response_data ( response_data)
31
31
// if we want json, we can parse & serialize it here
32
32
}
33
33
34
34
fn get_schema_from_response_data (
35
- response_data : get_schema_query :: ResponseData ,
35
+ response_data : fetch_schema_query :: ResponseData ,
36
36
) -> Result < String , RoverClientError > {
37
37
let service_data = match response_data. service {
38
38
Some ( data) => Ok ( data) ,
@@ -61,7 +61,7 @@ mod tests {
61
61
}
62
62
}
63
63
} ) ;
64
- let data: get_schema_query :: ResponseData = serde_json:: from_value ( json_response) . unwrap ( ) ;
64
+ let data: fetch_schema_query :: ResponseData = serde_json:: from_value ( json_response) . unwrap ( ) ;
65
65
let output = get_schema_from_response_data ( data) ;
66
66
67
67
assert ! ( output. is_ok( ) ) ;
@@ -71,7 +71,7 @@ mod tests {
71
71
#[ test]
72
72
fn get_schema_from_response_data_errs_on_no_service ( ) {
73
73
let json_response = json ! ( { "service" : null } ) ;
74
- let data: get_schema_query :: ResponseData = serde_json:: from_value ( json_response) . unwrap ( ) ;
74
+ let data: fetch_schema_query :: ResponseData = serde_json:: from_value ( json_response) . unwrap ( ) ;
75
75
let output = get_schema_from_response_data ( data) ;
76
76
77
77
assert ! ( output. is_err( ) ) ;
@@ -84,7 +84,7 @@ mod tests {
84
84
"schema" : null
85
85
}
86
86
} ) ;
87
- let data: get_schema_query :: ResponseData = serde_json:: from_value ( json_response) . unwrap ( ) ;
87
+ let data: fetch_schema_query :: ResponseData = serde_json:: from_value ( json_response) . unwrap ( ) ;
88
88
let output = get_schema_from_response_data ( data) ;
89
89
90
90
assert ! ( output. is_err( ) ) ;
0 commit comments