Description
Implement cross-field validation by adding an equals marker and extending existing comparison operators to reference other fields.
Implementation Details
1. New equals marker:
type PasswordForm struct {
// +govalid:minlength=8
Password string
// +govalid:equals=Password
Confirm string
}
2. Extend existing comparison operators:
type PriceRange struct {
// +govalid:required
MinPrice int
// +govalid:gt=MinPrice // References MinPrice field
MaxPrice int
}
type DateRange struct {
StartDate time.Time
// +govalid:gte=StartDate // References StartDate field
EndDate time.Time
}
Parameter interpretation:
- Numeric values: Compare as fixed values (current behavior)
- Identifiers: Reference fields in the same struct
- equals marker supports all types for equality checking
Success Criteria
- equals marker implemented
- Existing operators support field references
- Clear distinction between values and field references
- Comprehensive test coverage
Description
Implement cross-field validation by adding an equals marker and extending existing comparison operators to reference other fields.
Implementation Details
1. New equals marker:
2. Extend existing comparison operators:
Parameter interpretation:
Success Criteria