Description: Amount validation (numeric string, positive, within range) is repeated across CreatePaymentBody, CreateSettlementBody, and FX quote schemas. A reusable amount validator would reduce duplication.
Requirements:
- Define
AmountString schema: numeric string (regex), transform to parse, validate positive
- Define
PositiveAmountString for amounts that must be > 0
- Use across all amount-related schemas
Suggested execution steps:
- Create
AmountString = z.string().regex(/^\d+(\.\d+)?$/, 'must be a numeric string')
- Create
PositiveAmountString = AmountString.refine((s) => parseFloat(s) > 0, 'must be greater than 0')
- Replace inline regex usage in existing schemas
- Export both schemas and their inferred types
Example commit message:
refactor(validation): extract reusable amount string validation schemas
Shared AmountString and PositiveAmountString schemas replace duplicated
numeric string regex validation across payment and settlement schemas.
Description: Amount validation (numeric string, positive, within range) is repeated across
CreatePaymentBody,CreateSettlementBody, and FX quote schemas. A reusable amount validator would reduce duplication.Requirements:
AmountStringschema: numeric string (regex), transform to parse, validate positivePositiveAmountStringfor amounts that must be > 0Suggested execution steps:
AmountString = z.string().regex(/^\d+(\.\d+)?$/, 'must be a numeric string')PositiveAmountString = AmountString.refine((s) => parseFloat(s) > 0, 'must be greater than 0')Example commit message: