MCPcopy Create free account
hub / github.com/hashintel/hash / main

Function main

libs/@local/graph/api/src/bin/openapi-spec-generator.rs:6–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4use hash_graph_api::rest::OpenApiDocumentation;
5
6fn 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}

Callers

nothing calls this directly

Calls 5

OkInterface · 0.85
joinMethod · 0.45
attach_withMethod · 0.45
attachMethod · 0.45
displayMethod · 0.45

Tested by

no test coverage detected