Skip to content

Commit

Permalink
Update Swagger UI & build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
juhaku committed Jan 26, 2022
1 parent cbdf11b commit c8a9638
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
Cargo.lock
*.iml
.idea
*.orig
15 changes: 12 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
use std::process::Command;

const SWAGGER_UI_DIST_ZIP: &str = "swagger-ui-3.52.5";
const SWAGGER_UI_DIST_ZIP: &str = "swagger-ui-4.3.0";

fn main() {
println!("cargo:rerun-if-changed={}.zip", SWAGGER_UI_DIST_ZIP);
println!("cargo:rerun-if-changed=res/{}.zip", SWAGGER_UI_DIST_ZIP);

Command::new("unzip")
.arg(&format!("{}.zip", SWAGGER_UI_DIST_ZIP))
.arg(&format!("res/{}.zip", SWAGGER_UI_DIST_ZIP))
.arg(&format!("{}/dist/**", SWAGGER_UI_DIST_ZIP))
.args(&["-d", "target"])
.status()
.unwrap();

Command::new("sed")
.args(&[
"-i",
r#"s|url: ".*",|{{urls}},|"#,
&format!("target/{}/dist/index.html", SWAGGER_UI_DIST_ZIP),
])
.status()
.unwrap();
}
Binary file added res/swagger-ui-4.3.0.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion src/swagger_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rust_embed::RustEmbed;
use crate::openapi::OpenApi;

#[derive(RustEmbed)]
#[folder = "target/swagger-ui-3.52.5/dist/"]
#[folder = "target/swagger-ui-4.3.0/dist/"]
pub struct SwaggerUiDist;

#[non_exhaustive]
Expand Down
Binary file removed swagger-ui-3.52.5.zip
Binary file not shown.

0 comments on commit c8a9638

Please sign in to comment.