-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Refactor the Validator interface to eliminate redundancy and centralize field information handling.
Implementation Details
New interface design:
type Validator interface {
Validate(field *FieldInfo) ValidationCheck
}
type FieldInfo struct {
Name string
Type types.Type
StructName string
Path string
}
type ValidationCheck struct {
Condition string // "len(t.Name) == 0"
ErrorType string // "required"
Reason string // "field is required"
Imports []string // ["unicode/utf8"]
}Benefits:
- Validators no longer duplicate field information
- Error generation logic is centralized
- Easier to implement new validators
Success Criteria
- All existing validators migrated to new interface
- Reduced code duplication
- Simplified validator implementations
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request