From b8e5f07018783f8b54fdb0937835ca222d664ce6 Mon Sep 17 00:00:00 2001 From: Nander Stabel Date: Tue, 2 Dec 2025 14:25:50 +0100 Subject: [PATCH 1/4] fix: introduce `TemplateDto` for API `camelCase` responses --- agent_api_rest/src/library/templates/mod.rs | 83 ++++++++++++++++++++- 1 file changed, 79 insertions(+), 4 deletions(-) diff --git a/agent_api_rest/src/library/templates/mod.rs b/agent_api_rest/src/library/templates/mod.rs index bf7f809c..92f0431d 100644 --- a/agent_api_rest/src/library/templates/mod.rs +++ b/agent_api_rest/src/library/templates/mod.rs @@ -1,7 +1,7 @@ use crate::handlers::{command_handler, query_handler}; use crate::API_VERSION; use agent_library::state::LibraryState; -pub use agent_library::template::aggregate::{CredentialFormat, Display, HolderType, Status, Visibility}; +use agent_library::template::aggregate::{CredentialFormat, Display, HolderType, Status, Template, Visibility}; use agent_library::template::command::TemplateCommand; use axum::{ extract::{Path, State}, @@ -13,6 +13,45 @@ use hyper::{header, StatusCode}; use serde::{Deserialize, Serialize}; use tracing::debug; +/// Data transfer object for Templates. +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TemplateDto { + pub template_id: String, + pub title: Option, + pub display: Option, + pub credential_format: Option, + pub creator: Option, + pub holder_type: Option, + pub modified_at: Option, + pub tags: Vec, + pub status: Status, + pub visibility: Visibility, + pub description: Option, + pub r#type: Vec, + pub schema: Option, +} + +impl From