Skip to content

Commit f53e326

Browse files
committed
Doc fixes
1 parent ee01704 commit f53e326

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

devolutions-agent/src/updater/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,10 +917,7 @@ fn elapsed_since_last_check_secs(
917917
now_local: time::OffsetDateTime,
918918
last_check_at_local: Option<time::OffsetDateTime>,
919919
) -> Option<u64> {
920-
last_check_at_local.map(|last| {
921-
u64::try_from((now_local - last).whole_seconds())
922-
.unwrap_or(0)
923-
})
920+
last_check_at_local.map(|last| u64::try_from((now_local - last).whole_seconds()).unwrap_or(0))
924921
}
925922

926923
/// Compute how long to sleep before the next auto-update check.

devolutions-gateway/openapi/gateway-api.yaml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ paths:
653653
application/json:
654654
schema:
655655
allOf:
656-
- $ref: '#/components/schemas/UpdateRequest'
656+
- $ref: '#/components/schemas/UpdateRequestSchema'
657657
nullable: true
658658
required: false
659659
responses:
@@ -1677,17 +1677,11 @@ components:
16771677
UpdateRequest:
16781678
type: object
16791679
description: |-
1680-
Request body for the unified update endpoint.
1680+
OpenAPI schema for the update request body.
16811681
1682-
Every key in `Products` is a product name. Known products (`Gateway`, `Agent`,
1683-
`HubService`) are processed natively; any other name is forwarded as-is to the
1684-
agent so future product types are supported transparently.
1685-
properties:
1686-
Products:
1687-
type: object
1688-
description: Map of product name to API-specific product info.
1689-
additionalProperties:
1690-
$ref: '#/components/schemas/UpdateProductInfo'
1682+
The API accepts a map from product name to update information.
1683+
additionalProperties:
1684+
$ref: '#/components/schemas/UpdateProductInfo'
16911685
UpdateResponse:
16921686
type: object
16931687
description: Response returned by the update endpoint.
@@ -1721,4 +1715,3 @@ components:
17211715
scheme: bearer
17221716
bearerFormat: JWT
17231717
description: Token allowing usage of the standalone web application
1724-

devolutions-gateway/src/api/update.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ impl serde::Serialize for UpdateProduct {
164164
/// Every key in `Products` is a product name. Known products (`Gateway`, `Agent`,
165165
/// `HubService`) are processed natively; any other name is forwarded as-is to the
166166
/// agent so future product types are supported transparently.
167-
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
168167
#[derive(Debug, Default, Deserialize)]
169168
#[serde(rename_all = "PascalCase")]
170169
pub(crate) struct UpdateRequest {
@@ -173,6 +172,15 @@ pub(crate) struct UpdateRequest {
173172
pub products: HashMap<UpdateProduct, UpdateProductInfo>,
174173
}
175174

175+
/// OpenAPI schema for the update request body.
176+
///
177+
/// The API accepts a map from product name to update information.
178+
#[cfg(feature = "openapi")]
179+
#[derive(Serialize, utoipa::ToSchema)]
180+
#[schema(as = UpdateRequest)]
181+
#[serde(transparent)]
182+
pub(crate) struct UpdateRequestSchema(pub HashMap<String, UpdateProductInfo>);
183+
176184
/// Response returned by the update endpoint.
177185
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
178186
#[derive(Serialize)]
@@ -270,7 +278,7 @@ fn apply_products(req: UpdateRequest, manifest: &mut UpdateManifestV2, was_v2: b
270278
params(
271279
("version" = Option<String>, Query, deprecated, description = "Gateway-only target version; use the request body for multi-product updates"),
272280
),
273-
request_body(content = Option<UpdateRequest>, description = "Products and target versions to update", content_type = "application/json"),
281+
request_body(content = Option<UpdateRequestSchema>, description = "Products and target versions to update", content_type = "application/json"),
274282
responses(
275283
(status = 200, description = "Update request accepted", body = UpdateResponse),
276284
(status = 400, description = "Bad request"),

devolutions-gateway/src/openapi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use crate::config::dto::{DataEncoding, PubKeyFormat, Subscriber};
5555
crate::api::webapp::AppTokenSignRequest,
5656
crate::api::webapp::AppTokenContentType,
5757
crate::api::update::GetUpdateProductsResponse,
58-
crate::api::update::UpdateRequest,
58+
crate::api::update::UpdateRequestSchema,
5959
crate::api::update::UpdateProduct,
6060
crate::api::update::UpdateProductInfo,
6161
crate::api::update::UpdateResponse,

0 commit comments

Comments
 (0)