Skip to content

Commit

Permalink
Use options: GraphQLClientCodegenOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dphm committed Jan 12, 2024
1 parent 374f433 commit 0e44721
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions graphql_client_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ pub fn generate_module_token_stream(
let query = get_set_query_from_file(query_path.as_path());
let schema = get_set_schema_from_file(schema_path);

generate_module_token_stream_inner(&query, &schema, &options)
generate_module_token_stream_inner(&query, &schema, options)
}

/// Generates Rust code given a query string, a path to a schema file, and options.
pub fn generate_module_token_stream_from_string(
query_string: &str,
schema_path: &std::path::Path,
options: &GraphQLClientCodegenOptions,
options: GraphQLClientCodegenOptions,
) -> Result<TokenStream, BoxError> {
let query = (query_string.to_string(), query_document(query_string)?);
let schema = get_set_schema_from_file(schema_path);
Expand All @@ -123,7 +123,7 @@ pub fn generate_module_token_stream_from_string(
fn generate_module_token_stream_inner(
query: &(String, QueryDocument),
schema: &Schema,
options: &GraphQLClientCodegenOptions,
options: GraphQLClientCodegenOptions,
) -> Result<TokenStream, BoxError> {
let (query_string, query_document) = query;

Expand Down Expand Up @@ -158,7 +158,7 @@ fn generate_module_token_stream_inner(
schema,
resolved_query: &query,
operation: &operation.1.name,
options,
options: &options,
}
.to_token_stream()?;
modules.push(generated);
Expand Down
8 changes: 4 additions & 4 deletions graphql_client_codegen/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn schema_with_keywords_works() {
let options = GraphQLClientCodegenOptions::new(CodegenMode::Cli);

let generated_tokens =
generate_module_token_stream_from_string(query_string, &schema_path, &options)
generate_module_token_stream_from_string(query_string, &schema_path, options)
.expect("Generate keywords module");

let generated_code = generated_tokens.to_string();
Expand Down Expand Up @@ -52,7 +52,7 @@ fn fragments_other_variant_should_generate_unknown_other_variant() {
options.set_fragments_other_variant(true);

let generated_tokens =
generate_module_token_stream_from_string(query_string, &schema_path, &options)
generate_module_token_stream_from_string(query_string, &schema_path, options)
.expect("Generate foobars module");

let generated_code = generated_tokens.to_string();
Expand Down Expand Up @@ -80,7 +80,7 @@ fn fragments_other_variant_false_should_not_generate_unknown_other_variant() {
options.set_fragments_other_variant(false);

let generated_tokens =
generate_module_token_stream_from_string(query_string, &schema_path, &options)
generate_module_token_stream_from_string(query_string, &schema_path, options)
.expect("Generate foobars module token stream");

let generated_code = generated_tokens.to_string();
Expand Down Expand Up @@ -108,7 +108,7 @@ fn skip_serializing_none_should_generate_serde_skip_serializing() {
options.set_skip_serializing_none(true);

let generated_tokens =
generate_module_token_stream_from_string(query_string, &schema_path, &options)
generate_module_token_stream_from_string(query_string, &schema_path, options)
.expect("Generate foobars module");

let generated_code = generated_tokens.to_string();
Expand Down

0 comments on commit 0e44721

Please sign in to comment.