Skip to content

Commit 25aec5e

Browse files
committed
Change graphql-query-derive's GraphqlClientDeriveOption
1 parent b688201 commit 25aec5e

File tree

1 file changed

+11
-1
lines changed
  • graphql_query_derive/src

1 file changed

+11
-1
lines changed

graphql_query_derive/src/lib.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,18 @@ fn build_graphql_client_derive_options(input: &syn::DeriveInput) -> GraphQLClien
4242
// The user can determine what to do about deprecations.
4343
let deprecation_strategy = deprecation::extract_deprecation_strategy(input).unwrap_or_default();
4444

45+
let selected_operation_name = attributes::extract_attr(input, "selected_operation")
46+
.context("Extracting selected operation name");
47+
let selected_operation_name = if selected_operation_name.is_ok() {
48+
Some(selected_operation_name.unwrap())
49+
} else {
50+
Some(input.ident.to_string())
51+
};
52+
4553
GraphQLClientDeriveOptions {
46-
struct_name: input.ident.to_string(),
54+
operation_name: selected_operation_name,
55+
struct_name: Some(input.ident.to_string()),
56+
module_name: Some(input.ident.to_string()),
4757
additional_derives: response_derives,
4858
deprecation_strategy: Some(deprecation_strategy),
4959
}

0 commit comments

Comments
 (0)