
Ensure all Handlebars templates pass structural validation, edge case coverage, and conditional logic checks before deploying to TATA AIG production systems.
PolicyHolder Schema
Core β Personal Lines
Vehicle Coverage Schema
Auto β Commercial
Claims Submission Schema
Claims β FNOL
Premium Calculation Schema
Actuarial β Pricing
Beneficiary Declaration Schema
Life β Personal Lines
Endorsement Rider Schema
Policy β Amendments
Renewal Notice Schema
Communications β Ops
Property Appraisal Schema
Property β Commercial
Joi schema constraints per field β hover to highlight, click Edit to adjust inline
| Field Name | Type | Required | Min / Max | Pattern | Conditional Rules | Actions |
|---|---|---|---|---|---|---|
| policyNumber | string | βYes | min: 8 max: 20 | /^POL-[0-9]{6}$/ | ||
| insuredName | string | βYes | min: 2 max: 120 | /^[A-Za-z ]+$/ | β | |
| premiumAmount | number | βYes | min: 0.01 max: 999999.99 | β | ||
| coverageType | string | βYes | β | enum: basic|standard|premium|enterprise | β | |
| effectiveDate | date | βYes | min: today max: +5y | ISO 8601 | ||
| beneficiaries | array | β | min: 1 item max: 10 items | β | ||
| agentId | string | βYes | min: 6 max: 12 | /^AGT-[0-9]+$/ | β | |
| riderData | object | β | β | β |
Identified schema edge cases, severity levels, and resolution tracking
Null beneficiary field when policy holder is a corporate entity
Test Results
Developer Notes
Corporate entities may omit beneficiary entirely. Need to add .optional() to beneficiary field and update Handlebars {{#if beneficiary}} guard.
Premium amount exceeds max integer boundary in monthly billing cycle
Test Results
Developer Notes
Joi max() set to 999999 but TATA AIG commercial policies can exceed this. Increase limit to 9999999 and add .precision(2) for currency accuracy.
Date range overlap when policy renewal coincides with grace period
Test Results
Developer Notes
Custom Joi .custom() validator needed to detect overlap between renewalDate and graceEndDate. Suggest adding crossField validation utility.
Missing endorsement fields when rider count is zero in health schema
Test Results
Developer Notes
Resolved by wrapping endorsements in Joi.array().min(0).optional(). Handlebars {{#each riders}} now guarded with {{#if riders.length}} outer check.
Agent code validation fails for legacy 6-digit alphanumeric identifiers
Test Results
Developer Notes
Updated agentCode pattern to /^[A-Z0-9]{6,8}$/ to cover both legacy and new identifier formats used across TATA AIG regional branches.
Multi-vehicle policy generates duplicate vehicle entry when VIN is reused
Test Results
Developer Notes
Joi does not natively enforce cross-array item uniqueness. Need a .custom() validator iterating vehicle array to check VIN uniqueness before submission.
Visual flow of conditional branches, decision points, and action nodes in your Handlebars template. Click any node to inspect its snippet.
Side-by-side validation of the Figma/Adobe design snapshot vs. the inferred Joi schema. Review highlighted differences before approving.
Design Snapshot
Figma / AdobepolicyNumber
insuredName
premiumAmount
coverageStart
coverageEnd
beneficiaryEmail
isActivePolicy
claimHistoryCount
Inferred Joi Schema
policySchema.jsconst policySchema = Joi.object({ // Core identifiers policyNumber: Joi.string().min(6).required(), insuredName: Joi.string().max(120).required(), // Financial fields premiumAmount: Joi.number().positive(), // MISMATCH: design expects currency string // Temporal fields coverageStart: Joi.date().iso().required(), coverageEnd: Joi.date().iso().min(Joi.ref("coverageStart")).required(), // Contact β inferred from template refs beneficiaryEmail: Joi.string().email().optional(), // MISSING in design // Flags isActivePolicy: Joi.boolean().default(true), // Extra inferred from Handlebars partials agentCode: Joi.string().alphanum().length(8), // EXTRA: inferred from partial riskZone: Joi.string().valid("LOW","MED","HIGH"), // EXTRA: inferred from conditional // Type mismatch detected claimHistoryCount: Joi.number().precision(2), // MISMATCH: should be integer });
Missing required field validation
Field "policyHolder.dob" lacks .required() constraint. Insurance schema demands mandatory date of birth.
policyHolder.dobInvalid type coercion on premium amount
Joi.number() coercing string inputs silently. Premium must reject non-numeric values with explicit message.
premium.annualAmountEdge case: null beneficiaries array
Schema does not handle null vs empty array for beneficiaries. Coverage calculations may fail at runtime.
beneficiaries[]All checks must pass before deploying to production.
Core Validation
Schema Validity
Joi schema passes all structural validation constraints and type checks.
Edge Case Coverage
All identified edge cases are resolved and test coverage is at 100%.
Quality Standards
Responsive Design Check
Template renders correctly across 320px, 768px, and 1440px viewports.
Performance Metrics
Render time < 200ms, Cumulative Layout Shift < 0.1, no unoptimized assets.
Security & Compliance
Security Validation
Handlebars helpers sanitized, no XSS vectors, content-security-policy headers validated.
No comments yet. Be the first!