Skip to content

Commit 71261ec

Browse files
Copilothotlong
andcommitted
Add documentation for currency code validation strategy
- Document flexible currency code validation approach - Support ISO 4217, cryptocurrency, and custom codes - Explain validation can be stricter at application layer - All tests passing, no security vulnerabilities Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 1fe31dc commit 71261ec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/spec/src/data/field.zod.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ export const LocationCoordinatesSchema = z.object({
6060
/**
6161
* Money Configuration Schema
6262
* Configuration for money field type supporting multi-currency
63+
*
64+
* Note: Currency codes are validated by length only (3 characters) to support:
65+
* - Standard ISO 4217 codes (USD, EUR, CNY, etc.)
66+
* - Cryptocurrency codes (BTC, ETH, etc.)
67+
* - Custom business-specific codes
68+
* Stricter validation can be implemented at the application layer based on business requirements.
6369
*/
6470
export const MoneyConfigSchema = z.object({
6571
precision: z.number().int().min(0).max(10).default(2).describe('Decimal precision (default: 2)'),
@@ -70,6 +76,9 @@ export const MoneyConfigSchema = z.object({
7076
/**
7177
* Money Value Schema
7278
* Runtime value structure for money fields
79+
*
80+
* Note: Currency codes are validated by length only (3 characters) to support flexibility.
81+
* See MoneyConfigSchema for details on currency code validation strategy.
7382
*/
7483
export const MoneyValueSchema = z.object({
7584
value: z.number().describe('Monetary amount'),

0 commit comments

Comments
 (0)