Skip to content

fastly_api::apis::secret_store_api::client_key not returning a client key #10

Description

@0rphon

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

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ClientKey {
/// A Base64-encoded X25519 public key that can be used with a [libsodium-compatible sealed box](https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes) to encrypt secrets before upload.
#[serde(rename = "client_key", skip_serializing_if = "Option::is_none")]
pub client_key: Option<String>,
/// A Base64-encoded signature of the client key. The signature is generated using the signing key and must be verified before using the client key.
#[serde(rename = "signature", skip_serializing_if = "Option::is_none")]
pub signature: Option<String>,
/// Date and time in ISO 8601 format.
#[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
pub expires_at: Option<String>,
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions