Skip to content
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

make query parameters optional #19

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn pathop_to_string(path: &str, input: &PathOp, method: &str) -> String {
.enumerate()
.map(|(s, p)| {
format!(
"\t{}: {}{}\n",
"\t{}: Option<{}>{}\n",
fix_keywords(&p.name),
get_inner_type(p.schema.as_ref().unwrap().clone(), false),
if s < &input.parameters.len() - 1 {
Expand All @@ -203,7 +203,7 @@ fn pathop_to_string(path: &str, input: &PathOp, method: &str) -> String {
.clone()
.unwrap_or(make_fn_name_from_path(&path));
let fn_struct_name = fn_name.to_case(Case::Pascal) + "Query";
let fn_struct = format!("#[derive(Debug, Serialize, Deserialize)]\npub struct {fn_struct_name} {{\n{fn_struct_params}}}");
let fn_struct = format!("#[derive(Debug, Serialize, Deserialize, Default)]\npub struct {fn_struct_name} {{\n{fn_struct_params}}}");
let comment = make_comment(input.description.clone().unwrap(), 0);
let mut path_args = input
.parameters
Expand Down
Loading