Skip to content

Commit bc371b8

Browse files
chore: openapi refactored for params
1 parent 6ff4ae5 commit bc371b8

File tree

3 files changed

+418
-1429
lines changed

3 files changed

+418
-1429
lines changed

crates/api_models/src/blocklist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub type DeleteFromBlocklistRequest = BlocklistRequest;
1616
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
1717
pub struct BlocklistResponse {
1818
pub fingerprint_id: String,
19+
#[schema(value_type = BlocklistDataKind)]
1920
pub data_kind: enums::BlocklistDataKind,
2021
#[serde(with = "common_utils::custom_serde::iso8601")]
2122
pub created_at: time::PrimitiveDateTime,
@@ -26,6 +27,7 @@ pub type DeleteFromBlocklistResponse = BlocklistResponse;
2627

2728
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
2829
pub struct ListBlocklistQuery {
30+
#[schema(value_type = BlocklistDataKind)]
2931
pub data_kind: enums::BlocklistDataKind,
3032
#[serde(default = "default_list_limit")]
3133
pub limit: u16,

crates/router/src/routes/blocklist.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
#[utoipa::path(
1212
post,
1313
path = "/blocklist",
14-
request_body = AddToBlocklist,
14+
request_body = BlocklistRequest,
1515
responses(
1616
(status = 200, description = "Fingerprint Blocked", body = BlocklistResponse),
1717
(status = 400, description = "Invalid Data")
@@ -47,7 +47,7 @@ pub async fn add_entry_to_blocklist(
4747
#[utoipa::path(
4848
delete,
4949
path = "/blocklist",
50-
request_body = DeleteFromBlocklistRequest,
50+
request_body = BlocklistRequest,
5151
responses(
5252
(status = 200, description = "Fingerprint Unblocked", body = BlocklistResponse),
5353
(status = 400, description = "Invalid Data")
@@ -84,7 +84,7 @@ pub async fn remove_entry_from_blocklist(
8484
get,
8585
path = "/blocklist",
8686
params (
87-
("data_kind" = BlocklistDataKind, Path, description = "Kind of the fingerprint list requested"),
87+
("data_kind" = BlocklistDataKind, Query, description = "Kind of the fingerprint list requested"),
8888
),
8989
responses(
9090
(status = 200, description = "Blocked Fingerprints", body = BlocklistResponse),

0 commit comments

Comments
 (0)