mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-28 16:02:47 +00:00
feat: forward a pinned version through the hub project export proxy (#12022)
The proxy rebuilds the hub URL instead of passing the request through, so a `?version=` on it was dropped and the current version exported in its place. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bac1e463e5
commit
7b1dce5af0
@@ -28424,6 +28424,13 @@ paths:
|
||||
description: folder scoping the Hub project source (`{workspace}:{folder}`)
|
||||
schema:
|
||||
type: string
|
||||
- name: version
|
||||
in: query
|
||||
required: false
|
||||
description: id of a reviewed project version to export instead of the current one (see the hub's `/projects/{slug}/versions`)
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
responses:
|
||||
"200":
|
||||
description: raw Hub response body (status code is passed through from the Hub)
|
||||
|
||||
@@ -536,14 +536,26 @@ async fn publish_migrations(
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct ExportQuery {
|
||||
version: Option<u32>,
|
||||
}
|
||||
|
||||
// Export is owner-scoped only when re-exporting your own draft; approved
|
||||
// projects are public, so the folder scope is optional here.
|
||||
// projects are public, so the folder scope is optional here. `version` pins one
|
||||
// reviewed version instead of the current one; it is forwarded explicitly because
|
||||
// the hub request is rebuilt rather than proxied, so an unforwarded param would
|
||||
// silently export the current version instead.
|
||||
async fn get_project_export(
|
||||
ctx: HubPublishCtx,
|
||||
Path((_workspace, slug)): Path<(String, ProjectSlug)>,
|
||||
Query(query): Query<ExportQuery>,
|
||||
) -> Result<impl IntoResponse, Error> {
|
||||
ctx.get_maybe_unscoped(&format!("/projects/{}/export", slug))
|
||||
.await
|
||||
let path = match query.version {
|
||||
Some(v) => format!("/projects/{}/export?version={}", slug, v),
|
||||
None => format!("/projects/{}/export", slug),
|
||||
};
|
||||
ctx.get_maybe_unscoped(&path).await
|
||||
}
|
||||
|
||||
async fn get_project_by_source(ctx: HubPublishCtx) -> Result<impl IntoResponse, Error> {
|
||||
|
||||
Reference in New Issue
Block a user