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:
François-Xavier Talbot
2026-07-04 14:19:21 +00:00
committed by GitHub
co-authored by aecsocket
parent b26d048a63
commit 4a6fa9fc3d
103 changed files with 4546 additions and 1387 deletions
+24 -1
View File
@@ -59,6 +59,21 @@ const MULTIPLES: [u64; 12] = [
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Base62Id(pub u64);
impl utoipa::PartialSchema for Base62Id {
fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
utoipa::openapi::ObjectBuilder::new()
.schema_type(utoipa::openapi::schema::Type::String)
.min_length(Some(8))
.max_length(Some(8))
.pattern(Some("^[A-Za-z0-9]{8}$"))
.examples([serde_json::json!("ABcd1234")])
.build()
.into()
}
}
impl utoipa::ToSchema for Base62Id {}
/// An error decoding a number from base62.
#[derive(Error, Debug)]
pub enum DecodingError {
@@ -94,12 +109,20 @@ macro_rules! base62_id {
serde::Deserialize,
Debug,
Hash,
utoipa::ToSchema,
)]
#[serde(from = "ariadne::ids::Base62Id")]
#[serde(into = "ariadne::ids::Base62Id")]
pub struct $struct(pub u64);
impl utoipa::PartialSchema for $struct {
fn schema()
-> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
<$crate::ids::Base62Id as utoipa::PartialSchema>::schema()
}
}
impl utoipa::ToSchema for $struct {}
$crate::ids::impl_base62_display!($struct);
impl From<$crate::ids::Base62Id> for $struct {