Skip to content

Commit

Permalink
add SmolStrPolyfill to openapi components and change VecDeque schema …
Browse files Browse the repository at this point in the history
…values to Vec (#363)
  • Loading branch information
zeerooth authored Oct 3, 2023
1 parent e028205 commit 65f69c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/kitsune-type/src/mastodon/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use utoipa::ToSchema;

#[derive(Deserialize, Serialize, ToSchema)]
pub struct Context {
#[schema(value_type = Vec<Status>)]
pub ancestors: VecDeque<Status>,
pub descendants: Vec<Status>,
}
Expand Down
7 changes: 7 additions & 0 deletions kitsune/src/http/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ impl Modify for SecurityAddon {
}
}

#[derive(ToSchema)]
#[schema(as = SmolStr)]
struct SmolStrPolyfill(String);

#[derive(ToSchema)]
#[schema(as = Timestamp)]
struct TimestampPolyfill(String);

#[derive(OpenApi)]
#[openapi(
components(schemas(
SmolStrPolyfill,
TimestampPolyfill,
mastodon_type::App,
mastodon_type::account::Account,
Expand All @@ -45,6 +50,8 @@ struct TimestampPolyfill(String);
mastodon_type::instance::Instance,
mastodon_type::media_attachment::MediaType,
mastodon_type::media_attachment::MediaAttachment,
mastodon_type::preview_card::PreviewCard,
mastodon_type::preview_card::PreviewType,
mastodon_type::relationship::Relationship,
mastodon_type::search::SearchResult,
mastodon_type::status::Context,
Expand Down

0 comments on commit 65f69c4

Please sign in to comment.