diff options
| author | rtkay123 <dev@kanjala.com> | 2026-03-30 12:09:10 +0200 |
|---|---|---|
| committer | rtkay123 <dev@kanjala.com> | 2026-03-30 12:09:10 +0200 |
| commit | 1b5622e14ca3deaf2a25ee785af656779ded7a41 (patch) | |
| tree | 9c26ce03ed2f13ccffb144714b62904e25ff6fbe /lib/api-config/src/schema/mod.rs | |
| parent | 562d4855e957bebf8d98b56e40cdd50beea54d84 (diff) | |
| download | warden-1b5622e14ca3deaf2a25ee785af656779ded7a41.tar.bz2 warden-1b5622e14ca3deaf2a25ee785af656779ded7a41.zip | |
feat(api): examples
Diffstat (limited to 'lib/api-config/src/schema/mod.rs')
| -rw-r--r-- | lib/api-config/src/schema/mod.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/api-config/src/schema/mod.rs b/lib/api-config/src/schema/mod.rs index 1fdbcef..d1ef5f4 100644 --- a/lib/api-config/src/schema/mod.rs +++ b/lib/api-config/src/schema/mod.rs @@ -11,6 +11,37 @@ use crate::ConfigurationError; /// Transaction to monitor #[derive(Deserialize, Serialize)] #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] +#[cfg_attr(feature = "utoipa", schema(example = json!({ + "type": "custom.schema", + "version": "1.0.0", + "json_schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "FinancialTransaction", + "type": "object", + "required": ["transaction_id", "amount", "currency", "timestamp"], + "properties": { + "transaction_id": { + "type": "string", + "format": "uuid" + }, + "amount": { + "type": "number", + "exclusiveMinimum": 0 + }, + "currency": { + "type": "string", + "pattern": "^[A-Z]{3}$", + "description": "ISO 4217 Alpha-3 code (e.g., USD, EUR)" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + } + }, + "created_at": time::OffsetDateTime::now_utc().format(&time::format_description::well_known::Rfc3339).unwrap(), + "updated_at": time::OffsetDateTime::now_utc().format(&time::format_description::well_known::Rfc3339).unwrap(), +})))] pub struct TransactionSchema { #[serde(rename = "type")] /// Transaction schema type |
