From e7cf76a0d8c4c1ea2b378e6551bf48685c7ed06a Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sat, 6 Sep 2025 19:19:14 +0200 Subject: [PATCH] feat: rename fields in ApiKeyResponse and ThoughtSchema for consistency with API specifications --- thoughts-backend/models/src/schemas/api_key.rs | 2 +- thoughts-backend/models/src/schemas/thought.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/thoughts-backend/models/src/schemas/api_key.rs b/thoughts-backend/models/src/schemas/api_key.rs index 7dab33d..d55b490 100644 --- a/thoughts-backend/models/src/schemas/api_key.rs +++ b/thoughts-backend/models/src/schemas/api_key.rs @@ -17,7 +17,7 @@ pub struct ApiKeyResponse { #[serde(flatten)] pub key: ApiKeySchema, /// The full plaintext API key. This is only returned on creation. - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(skip_serializing_if = "Option::is_none", rename = "plaintextKey")] pub plaintext_key: Option, } diff --git a/thoughts-backend/models/src/schemas/thought.rs b/thoughts-backend/models/src/schemas/thought.rs index c672996..0fbd516 100644 --- a/thoughts-backend/models/src/schemas/thought.rs +++ b/thoughts-backend/models/src/schemas/thought.rs @@ -12,11 +12,14 @@ use uuid::Uuid; pub struct ThoughtSchema { pub id: Uuid, #[schema(example = "frutiger")] + #[serde(rename = "authorUsername")] pub author_username: String, #[schema(example = "This is my first thought! #welcome")] pub content: String, pub visibility: Visibility, + #[serde(rename = "replyToId")] pub reply_to_id: Option, + #[serde(rename = "createdAt")] pub created_at: DateTimeWithTimeZoneWrapper, }