MCPcopy Create free account
hub / github.com/TUM-Dev/NavigaTUM / add_static_openapi_docs

Function add_static_openapi_docs

server/src/docs.rs:59–141  ·  view source on GitHub ↗
(openapi: &mut OpenApi)

Source from the content-addressed store, hash-verified

57}
58
59fn add_static_openapi_docs(openapi: &mut OpenApi) {
60 use utoipa::openapi::extensions::ExtensionsBuilder;
61 use utoipa::openapi::external_docs::ExternalDocsBuilder;
62 use utoipa::openapi::tag::TagBuilder;
63 use utoipa::openapi::{ContactBuilder, InfoBuilder, LicenseBuilder, ServerBuilder};
64 let description = r"Navigating around TUM with excellence - An API to search for rooms,
65buildings and other places
66
67NavigaTUM is a tool developed by students for students, to help you get around at [TUM](https://tum.de). Feel free to contribute.
68
69- [x] Interactive/static maps to look up the position of rooms or buildings
70- [x] Fast and typo-tolerant search
71- [x] Support for different room code formats as well as generic names
72- [x] All functionality is also available via an open and well documented API
73- [x] Automatically update the data from upstream datasources
74- [x] Allow students/staff to easily submit feedback and data patches
75- [x] Generate turn by turn navigation advice for navigating end to end
76- [ ] Generate maps from CAD data sources
77
78If you'd like to help out or join us in this adventure, we would love to talk to you.";
79 openapi.info = InfoBuilder::new()
80 .title("NavigaTUM")
81 .description(Some(description))
82 .terms_of_service(Some("https://nav.tum.de/en/about/privacy"))
83 .contact(Some(
84 ContactBuilder::new()
85 .name(Some("OpenSource @ TUM e.V."))
86 .url(Some("https://tum.dev/"))
87 .email(Some("navigatum@tum.de"))
88 .build()
89 ))
90 .license(Some(
91 LicenseBuilder::new()
92 .name("GPL v3")
93 .url(Some("https://www.gnu.org/licenses/"))
94 .build()))
95 .version(env!("CARGO_PKG_VERSION"))
96 .extensions(Some(ExtensionsBuilder::new()
97 .add("logo", serde_json::to_value(OpenApiLogo{
98 href: Some("https://nav.tum.de".to_string()),
99 url: "https://raw.githubusercontent.com/TUM-Dev/NavigaTUM/refs/heads/main/webclient/app/assets/logos/navigatum.svg".to_string(),
100 ..OpenApiLogo::default()
101 }).expect("OpenApiLogo serializes to JSON cleanly"))
102 .build()))
103 .build();
104 openapi.servers = Some(vec![
105 ServerBuilder::new()
106 .url("https://nav.tum.de")
107 .description(Some("production"))
108 .build(),
109 ]);
110 openapi.tags = Some(vec![
111 TagBuilder::new()
112 .name("locations".to_string())
113 .description(Some("API to access/search for location information"))
114 .build(),
115 TagBuilder::new()
116 .name("calendar".to_string())

Callers 1

add_openapi_docsFunction · 0.85

Calls 4

buildMethod · 0.80
descriptionMethod · 0.80
urlMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected