()
| 4 | use hash_graph_api::rest::OpenApiDocumentation; |
| 5 | |
| 6 | fn main() -> Result<(), Report<io::Error>> { |
| 7 | let openapi_path = std::path::Path::new("openapi"); |
| 8 | let openapi_models_path = openapi_path.join("models"); |
| 9 | let openapi_json_path = openapi_path.join("openapi.json"); |
| 10 | for path in [openapi_models_path, openapi_json_path] { |
| 11 | if !path.exists() { |
| 12 | continue; |
| 13 | } |
| 14 | if path.is_file() { |
| 15 | fs::remove_file(&path) |
| 16 | .attach("could not remove old OpenAPI file") |
| 17 | .attach_with(|| path.display().to_string())?; |
| 18 | } else { |
| 19 | fs::remove_dir_all(&path) |
| 20 | .attach("could not remove old OpenAPI file") |
| 21 | .attach_with(|| path.display().to_string())?; |
| 22 | } |
| 23 | } |
| 24 | OpenApiDocumentation::write_openapi(openapi_path).attach("could not write OpenAPI spec")?; |
| 25 | |
| 26 | Ok(()) |
| 27 | } |
nothing calls this directly
no test coverage detected