Change only starter/validator.py.
- Implement
validate_transaction_payload(raw: dict) -> tuple[bool, dict]. - Return
(True, sanitized_dict)on success, or(False, errors_dict)on failure. - Key normalization:
- Support both
userIdanduser_id-> output normalizeduser_id: int. - Support both
amountas float/int or dirty currency string (e.g."$120.50"or" 120.50 ") -> outputamount: floatrounded to 2 decimal places. Amount must be > 0. statusmust be one of{"pending", "completed", "failed"}(case-insensitive) -> output lowercase string.
- Support both
- If payload is missing required fields or has invalid values, populate
errors_dictmapping field name to error message. - Do not raise unhandled exceptions on malformed input.
Done means python examples/pydantic-validation/verify.py starter exits successfully.