-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch struct causes errors when making requests #43
Comments
This was fixed in 79185b3 It'll be in 0.5.0 |
As a workaround until then, you can take the |
Thank you @Arnavion! I'll give this a shot. |
Note that you'll also need to set the These are listed in the spec but I can't think of a way to easily surface this choice to the API user. Maybe something like -struct Patch(serde_json::Value);
+enum Patch {
+ Json(serde_json::Value),
+ Merge(serde_json::Value),
+ StrategicMerge(serde_json::Value),
+} and then have every API operation that takes a It does look like patch operations are the only place where this kind of |
All operations with requests bodies, except for patch requests, now add a `Content-Type: application/json` header to the request. The `Patch` struct is now generated as an enum of `Json`, `Merge` and `StrategicMerge` variants, each wrapping a `serde_json::Value`. Patch operations use the variant of the `Patch` struct to set the appropriate `Content-Type` header. This commit also fixes the response types of delete-collection operations to contain the list type of the associated type, not the associated type itself. Ref #43 Fixes #49
All operations with requests bodies, except for patch requests, now add a `Content-Type: application/json` header to the request. The `Patch` type is now generated as an enum of `Json`, `Merge` and `StrategicMerge` variants, each wrapping a `serde_json::Value`. Patch operations use the variant of the `Patch` value to set the appropriate `Content-Type` header. This commit also fixes the response types of delete-collection operations to contain the list type of the associated type, not the associated type itself. Ref #43 Fixes #49
With 36334e6, |
I was trying to use the
Patch
struct to runpatch_namespaced_ingress
, but it appears based on both the documentation and the code that the only valid value ofbody
is an empty struct reference&Patch{}
.When I do that, I get the following error at run time:
This is likely because the JSON body on the API request needs values in the form of a JSON merge patch, eg:
At first I thought this was me being new to Rust and just missing how to do pass the
body
parameter correctly, like maybe I needed to build a JSON body with Serde and cast it to aPatch
struct. But then I showed my issue to another developer and they came to the same conclusion.I'm using the
v1_11
feature, for what it's worth. If there's any other information I can provide to clarify what I'm seeing, let me know! Thanks for building this!The text was updated successfully, but these errors were encountered: