-
-
Notifications
You must be signed in to change notification settings - Fork 366
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Current and expected behavior
Current
Calling replace_status, one must use this unergonomic (and I argue, unnecessary) extra serde_json::to_vec wrapper:
instances
.replace_status(
&name,
&PostParams::default(),
serde_json::to_vec(&serde_json::json!({ "status": initial_status }))?,
)
.await?;Expected
But patch_status is much more idiomatic and should be the way that replace_status also works:
instances
.patch_status(
&name,
&PatchParams::default(),
&Patch::Merge(&serde_json::json!({ "status": ready_status })),
)
.await?;Nice to have in the future (but would be a feature request and a major API change)
Why do we need the serde_json::json!({ "status": ready_status }) wrapper at all, when it should just be type-friendly (since Api<K> knows the type) and it could just be: .patch_status(... &Patch::Merge(ready_status)) or similar?
Possible solution
If it must use serde_json::to_vec internally, just make that internal. But I thought the kubernetes API just takes JSON anyway, so why does the API user need to convert it to the u8 vec first?
Additional context
No response
Environment
k3s / k3d -- but not really relevant, this is an API semantics issue
Configuration and features
No response
Affected crates
No response
Would you like to work on fixing this bug?
maybe
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working