Skip to content

Don't serialize Option::None for Inputs #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix ambigous names of generated struct+module
If a camel case query name like "ping_query" is used,
the generated code fails. Fixed by using `to_camel_case`
for the struct name, while the module name still uses `to_snake_case`.

Even for a single word query name like "ping" that should work.

Signed-off-by: David Graeff <david.graeff@web.de>
  • Loading branch information
David Graeff committed Aug 27, 2019
commit e8f8e478a713c8fd2392c3a5f15129ab3f58db5a
3 changes: 2 additions & 1 deletion graphql_client_codegen/src/generated_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a> GeneratedModule<'a> {
let module_name = Ident::new(&self.operation.name.to_snake_case(), Span::call_site());
let module_visibility = &self.options.module_visibility();
let operation_name_literal = &self.operation.name;
let operation_name_ident = Ident::new(&self.operation.name, Span::call_site());
let operation_name_ident = Ident::new(&self.operation.name.to_camel_case(), Span::call_site());

// Force cargo to refresh the generated code when the query file changes.
let query_include = self
Expand All @@ -52,6 +52,7 @@ impl<'a> GeneratedModule<'a> {
};

Ok(quote!(
#[allow(dead_code)]
#struct_declaration

#module_visibility mod #module_name {
Expand Down