Skip to content

Commit

Permalink
unify path params in openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
azhur committed Dec 24, 2024
1 parent 4d842f8 commit 12ee064
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 19 deletions.
2 changes: 1 addition & 1 deletion modules/meteroid/src/api_rest/files/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ pub use router::FileApi;

pub fn file_routes() -> Router<AppState> {
Router::new()
.route("/v1/logo/:uuid", get(router::get_logo))
.route("/v1/logo/{uuid}", get(router::get_logo))
.route("/v1/invoice/pdf/:uuid", get(router::get_invoice_pdf))
}
6 changes: 3 additions & 3 deletions modules/meteroid/src/api_rest/files/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct FileApi;
#[utoipa::path(
get,
tag = "file",
path = "/v1/logo/{uuid}",
path = "/v1/logo/:uuid",
params(
("uuid" = Uuid, Path, description = "Logo database UUID")
),
Expand Down Expand Up @@ -83,9 +83,9 @@ pub struct TokenParams {
#[utoipa::path(
get,
tag = "file",
path = "/v1/invoice/pdf/{uid}",
path = "/v1/invoice/pdf/:uid",
params(
("uuid" = String, Path, description = "Invoice database UID"),
("uid" = String, Path, description = "Invoice database UID"),
("token" = str, Query, description = "Security token"),
),
responses(
Expand Down
4 changes: 4 additions & 0 deletions modules/meteroid/src/api_rest/plans/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ use uuid::Uuid;
),
responses(
(status = 200, description = "List of plans", body = PaginatedResponse<Plan>),
(status = 401, description = "Unauthorized"),
(status = 500, description = "Internal error"),
),
security(
("api-key" = [])
)
)]
#[axum::debug_handler]
Expand Down
4 changes: 4 additions & 0 deletions modules/meteroid/src/api_rest/productfamilies/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ use uuid::Uuid;
),
responses(
(status = 200, description = "List of product families", body = PaginatedResponse<ProductFamily>),
(status = 401, description = "Unauthorized"),
(status = 500, description = "Internal error"),
),
security(
("api-key" = [])
)
)]
#[axum::debug_handler]
Expand Down
8 changes: 8 additions & 0 deletions modules/meteroid/src/api_rest/subscriptions/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ use uuid::Uuid;
),
responses(
(status = 200, description = "List of subscriptions", body = PaginatedResponse<Subscription>),
(status = 401, description = "Unauthorized"),
(status = 500, description = "Internal error"),
),
security(
("api-key" = [])
)
)]
#[axum::debug_handler]
Expand Down Expand Up @@ -96,7 +100,11 @@ async fn list_subscriptions_handler(
),
responses(
(status = 200, description = "Details of subscription", body = SubscriptionDetails),
(status = 401, description = "Unauthorized"),
(status = 500, description = "Internal error"),
),
security(
("api-key" = [])
)
)]
#[axum::debug_handler]
Expand Down
54 changes: 39 additions & 15 deletions spec/api/v1/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,18 @@
}
}
},
"401": {
"description": "Unauthorized"
},
"500": {
"description": "Internal error"
}
}
},
"security": [
{
"api-key": []
}
]
}
},
"/api/v1/product_families": {
Expand All @@ -249,10 +257,18 @@
}
}
},
"401": {
"description": "Unauthorized"
},
"500": {
"description": "Internal error"
}
}
},
"security": [
{
"api-key": []
}
]
}
},
"/api/v1/subscriptions": {
Expand Down Expand Up @@ -296,10 +312,18 @@
}
}
},
"401": {
"description": "Unauthorized"
},
"500": {
"description": "Internal error"
}
}
},
"security": [
{
"api-key": []
}
]
}
},
"/api/v1/subscriptions/:id": {
Expand Down Expand Up @@ -330,21 +354,29 @@
}
}
},
"401": {
"description": "Unauthorized"
},
"500": {
"description": "Internal error"
}
}
},
"security": [
{
"api-key": []
}
]
}
},
"/files/v1/invoice/pdf/{uid}": {
"/files/v1/invoice/pdf/:uid": {
"get": {
"tags": [
"file"
],
"operationId": "get_invoice_pdf",
"parameters": [
{
"name": "uuid",
"name": "uid",
"in": "path",
"description": "Invoice database UID",
"required": true,
Expand All @@ -360,14 +392,6 @@
"schema": {
"type": "string"
}
},
{
"name": "uid",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
Expand Down Expand Up @@ -398,7 +422,7 @@
}
}
},
"/files/v1/logo/{uuid}": {
"/files/v1/logo/:uuid": {
"get": {
"tags": [
"file"
Expand Down

0 comments on commit 12ee064

Please sign in to comment.