Skip to content

Commit

Permalink
Generation should create an empty methods.rs if none exists
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchalmers committed Oct 23, 2023
1 parent 68c4e27 commit 8d868d8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openapitor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ fn internal_generate(spec: &openapiv3::OpenAPI, opts: &Opts) -> Result<String> {
if module == "tests" {
a("#[cfg(test)]");
}
a("#[cfg(feature = \"requests\")]");
a(&format!("mod {};", module));
a(&format!("mod {module};"));
// Ensure that if there's no file, an empty file is created.
std::process::Command::new("touch")
.arg(format!("{}/src/{module}.rs", opts.output.display()))
.spawn()?
.wait()?;
}

// Hopefully there is never a "tag" named after these reserved libs.
Expand Down

0 comments on commit 8d868d8

Please sign in to comment.