fix: change serde field naming from camelCase to snake_case with explicit renames

Remove container-level camelCase rename attributes from LoginRequest, LoginResponse, EnrollRequest, EnrollResponse, PeerView, and GatewayView structs. Add explicit field-level serde rename attributes for snake_case fields (access_token, refresh_token, os_version, app_version, device_fingerprint, public_key, assigned_ip, profile_revision) to match backend API contract.
This commit is contained in:
2026-03-17 19:53:56 +01:00
parent dab7159cc5
commit f596f89665

View File

@@ -46,32 +46,34 @@ struct EnrollmentResult {
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct LoginRequest<'a> {
username: &'a str,
password: &'a str,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct LoginResponse {
#[serde(rename = "access_token")]
access_token: String,
#[serde(rename = "refresh_token")]
refresh_token: String,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct EnrollRequest<'a> {
name: &'a str,
platform: &'a str,
#[serde(rename = "os_version")]
os_version: &'a str,
#[serde(rename = "app_version")]
app_version: &'a str,
#[serde(rename = "device_fingerprint")]
device_fingerprint: String,
#[serde(rename = "public_key")]
public_key: String,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct EnrollResponse {
peer: PeerView,
profile: ProfileView,
@@ -79,15 +81,15 @@ struct EnrollResponse {
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct PeerView {
#[serde(rename = "assigned_ip")]
assigned_ip: String,
gateway: GatewayView,
#[serde(rename = "profile_revision")]
profile_revision: u32,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct GatewayView {
endpoint: String,
}