blazzy / podman-rest-client

MIT License
6 stars 1 forks source link

podman-rest-client = "0.10.1" .pods_api().pod_delete_libpod(...) response error. #13

Closed beckend closed 4 months ago

beckend commented 4 months ago
use podman_rest_client::{Config, PodmanRestClient};

let client = PodmanRestClient::new(Config::guess().await?).await?;
let name_str = "pod-named-exist";

client.pods_api()
  .pod_delete_libpod(name_str, Some(true))
  .await
  .map_err(|err| eyre!("Failed to delete {name_type} {name_str} - {err:?}"))?;
Error: Failed to delete Pod pod-named-exist - Serde(Error("invalid type: null, expected a string", line: 1, column: 87))

The pod is deleted, the error is decoding the response.

beckend commented 4 months ago

Actually, it's probably my implementation, I need to debug this.

beckend commented 4 months ago

Ok, debugged it, this happens every time for me.

blazzy commented 4 months ago

One line fix on the way. This is not the first issue I found with HashMaps and nil/null in the Podman API. There will probably be more issues like this.

I'm less than thrilled with podman, go, and go-swagger here. 😞

From the docs:

// NOTE: due to the limitations of [go-swagger](https://github.com/go-swagger/go-swagger),
// some field values that have a complex type show up as null in the docs as well as in the
// API responses. This is because the zero value for the field type is null. The field
// description in the docs will state what type the field is expected to be for such cases.