mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 10:34:53 +00:00
feat: better api docs (#6586)
* feat: docs * fix tombi * chore: fix some of the routes rendering with missing / * response schemas * fix: restore labrinth docs routes * Fix path parameter docs in routes * remove utoipa-actix-web * consistency * improve version intros * improve formatting, examples * better hash examples, move openapi stuff to openapi.rs * more utoipa param fixes * request body docs * chore: remove moderation route from v2, remove ingest & webhooks from v3 spec * fixes * chore: tweak sources titles * fix * fix test * improve examples * increase compiler spawned thread stack size * remove unused tests & script * test * bro what * fix --------- Co-authored-by: aecsocket <43144841+aecsocket@users.noreply.github.com>
This commit is contained in:
co-authored by
aecsocket
parent
b26d048a63
commit
4a6fa9fc3d
+42
-11
@@ -343,6 +343,14 @@ pub fn app_setup(
|
||||
pub fn app_config(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
labrinth_config: LabrinthConfig,
|
||||
) {
|
||||
app_data_config(cfg, labrinth_config);
|
||||
app_fallback_config(cfg);
|
||||
}
|
||||
|
||||
pub fn app_data_config(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
labrinth_config: LabrinthConfig,
|
||||
) {
|
||||
cfg.app_data(web::FormConfig::default().error_handler(|err, _req| {
|
||||
routes::ApiError::Validation(err.to_string()).into()
|
||||
@@ -379,16 +387,17 @@ pub fn app_config(
|
||||
.app_data(labrinth_config.rate_limiter.clone())
|
||||
.app_data(labrinth_config.kafka_client.clone())
|
||||
.app_data(labrinth_config.search_state.clone())
|
||||
.app_data(labrinth_config.webauthn.clone())
|
||||
.configure(routes::v3::config)
|
||||
.configure(routes::internal::config)
|
||||
.configure(routes::root_config)
|
||||
.default_service(web::get().wrap(default_cors()).to(routes::not_found));
|
||||
.app_data(labrinth_config.webauthn.clone());
|
||||
}
|
||||
|
||||
pub fn utoipa_app_config(
|
||||
cfg: &mut utoipa_actix_web::service_config::ServiceConfig,
|
||||
_labrinth_config: LabrinthConfig,
|
||||
pub fn app_fallback_config(cfg: &mut web::ServiceConfig) {
|
||||
cfg.configure(routes::root_config)
|
||||
.default_service(web::get().to(routes::not_found).wrap(default_cors()));
|
||||
}
|
||||
|
||||
pub fn app_routes_config(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
labrinth_config: LabrinthConfig,
|
||||
) {
|
||||
cfg.configure({
|
||||
#[cfg(target_os = "linux")]
|
||||
@@ -400,7 +409,29 @@ pub fn utoipa_app_config(
|
||||
|_cfg| ()
|
||||
}
|
||||
})
|
||||
.configure(routes::v2::utoipa_config)
|
||||
.configure(routes::v3::utoipa_config)
|
||||
.configure(routes::internal::utoipa_config);
|
||||
.configure(|cfg| app_routes_config_v2(cfg, labrinth_config.clone()))
|
||||
.configure(|cfg| app_routes_config_v3(cfg, labrinth_config.clone()))
|
||||
.configure(|cfg| app_routes_config_internal(cfg, labrinth_config));
|
||||
}
|
||||
|
||||
pub fn app_routes_config_v2(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
_labrinth_config: LabrinthConfig,
|
||||
) {
|
||||
cfg.configure(routes::v2::config);
|
||||
}
|
||||
|
||||
pub fn app_routes_config_v3(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
_labrinth_config: LabrinthConfig,
|
||||
) {
|
||||
cfg.configure(routes::public_config)
|
||||
.configure(routes::v3::config);
|
||||
}
|
||||
|
||||
pub fn app_routes_config_internal(
|
||||
cfg: &mut web::ServiceConfig,
|
||||
_labrinth_config: LabrinthConfig,
|
||||
) {
|
||||
cfg.configure(routes::internal::config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user