Skip to content

Commit 71387a9

Browse files
committed
fix(namespace): bring namespace_list api calls up to date
1 parent e7a7fa7 commit 71387a9

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

engine/artifacts/openapi.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/packages/api-peer/src/namespaces.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rivet_util::Id;
66
use serde::{Deserialize, Serialize};
77
use utoipa::ToSchema;
88

9+
// NOTE: This endpoint should be in sync with the namespace::get_global operation at engine/packages/namespace/src/ops/get_global.rs
910
#[tracing::instrument(skip_all)]
1011
pub async fn list(ctx: ApiCtx, _path: (), query: ListQuery) -> Result<ListResponse> {
1112
let namespace_ids = query.namespace_ids.as_ref().map(|x| {
@@ -62,8 +63,8 @@ pub async fn list(ctx: ApiCtx, _path: (), query: ListQuery) -> Result<ListRespon
6263
#[serde(deny_unknown_fields)]
6364
#[schema(as = NamespacesCreateRequest)]
6465
pub struct CreateRequest {
65-
name: String,
66-
display_name: String,
66+
pub name: String,
67+
pub display_name: String,
6768
}
6869

6970
#[derive(Serialize, Deserialize, ToSchema)]

engine/packages/namespace/src/ops/get_global.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ pub async fn namespace_get_global(ctx: &OperationCtx, input: &Input) -> Result<V
2727
let leader_dc = leader_dc.clone();
2828
let client = client.clone();
2929
async move {
30+
// NOTE: This endpoint call should be in sync with the namespaces list endpoint at engine/packages/api-peer/src/namespaces.rs
3031
let url = leader_dc.peer_url.join(&format!("/namespaces"))?;
3132
let res = client
3233
.get(url)
33-
.query(
34-
&namespace_ids
34+
.query(&[(
35+
"namespace_ids",
36+
namespace_ids
3537
.iter()
36-
.map(|ns_id| ("namespace_id", ns_id))
37-
.collect::<Vec<_>>(),
38-
)
38+
.map(|ns_id| ns_id.to_string())
39+
.collect::<Vec<_>>()
40+
.join(","),
41+
)])
3942
.send()
4043
.await?;
4144

0 commit comments

Comments
 (0)