fastly-rust icon indicating copy to clipboard operation
fastly-rust copied to clipboard

`fastly_api::apis::secret_store_api::client_key` not returning a client key

Open 0rphon opened this issue 1 year ago • 1 comments

it seems fastly_api::models::client_key::ClientKey has the wrong field name for the client key. the following should return a key, but instead returns none.

example (with my key omitted):

use fastly_api::apis::configuration::{ApiKey, Configuration};
use fastly_api::apis::secret_store_api::client_key;

#[tokio::main]
async fn main() {
    let mut config = Configuration {
        api_key: Some(ApiKey {
            prefix: None,
            key: "YOUR_FASTLY_TOKEN".into(),
        }),
        ..Default::default()
    };
    dbg!(client_key(&mut config).await);
}

output (with my exact values omitted):

[src/main.rs:13:5] client_key(&mut config).await = Ok(
    ClientKey {
        client_key: None,
        signature: Some(_),
        expires_at: Some(_),
    },
)

while the equivalent curl command curl -i -X POST "https://api.fastly.com/resources/stores/secret/client-key" -H "Fastly-Key: YOUR_FASTLY_TOKEN" -H "Accept: application/json" returns:

{
  "public_key": "omitted",
  "signature": "omitted",
  "expires_at": "omitted"
}

you'll notice the curl command returns the field public_key, while the rust call returns the field client_key. looking at the rust code we can see the same issue

https://github.com/fastly/fastly-rust/blob/cfa52f80058154f8a678a73409d4356b52a84e9b/src/models/client_key.rs#L12-L23

i would normally just fix this myself and PR it, but seeing how the library is generated from an openapi spec, i figured id just report it instead

0rphon avatar May 29 '24 18:05 0rphon

Updating this ticket to mark that an internal ticket exists to track this issue.

harmony7 avatar Jan 20 '25 04:01 harmony7