cloudflare / cloudflare-rs

Rust library for the Cloudflare v4 API
251 stars 74 forks source link

Owner deserialization error #193

Open augustuswm opened 1 year ago

augustuswm commented 1 year ago

Starting yesterday we started seeing errors where the response from ListZones were failing to deserialize correctly. It looks to be related to the owner field in the API response. The field in the response looks like:

{
  "owner": {
    "id": null,
    "type": "user",
    "email": null
  }
}

This conflicts with the Owner enum which expects the id and email fields to be non-null:

pub enum Owner {
    User { id: String, email: String },
    Organization { id: String, name: String },
}

Unsure if this was a recent change in the API, but presumably these should now be Option<String> if null is a valid response value? (Unclear if this is an API issue returning null when it shouldn't or if this is a library update)

taladar commented 2 weeks ago

This issue still exists in the latest master version. Personally I think the API response is strange though, I would expect null for the entire owner field in this case, not a User with null id and null email.