-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Currently the kittycad.rs test test_stream is failing. Why? Because it's trying to deserialize ApiCallWithPrice, but it finds an empty string when it tries to deserialize an IP address.
Test failure
---- tests::test_stream stdout ----
thread 'tests::test_stream' panicked at 'Serde Error:
1 | ...T07:00:23.846Z","ip_address":"","status_code":500,"method":"G...
| ^ invalid IP address syntax at line 1 column 8482785
', kittycad/src/tests.rs:112:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The relevant field is defined in kittycad.rs:
#[doc = "The ip address of the origin."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ip_address: Option<std::net::IpAddr>,and comes from this definition in api-deux
/// The ip address of the origin.
#[serde(default)]
pub ip_address: crate::db::ipaddr::IpAddr,Note that crate::db::ipaddr::IpAddr is a newtype around Option<std::net::IpAddr>, so kittycad.rs should know it can always be None and should deserialize the empty string into None.
This will require tweaking the Rust that openapitor outputs for openAPI fields like this, so, let's examine the OpenAPI spec for that field. It is:
"ip_address": {
"default": "",
"description": "The ip address of the origin.",
"format": "ip",
"title": "String",
"type": "string"
},Metadata
Metadata
Assignees
Labels
No labels