-
Notifications
You must be signed in to change notification settings - Fork 0
IBX-10471: [Inputs] Inputs Validators Base #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a base validation system for inputs with a validator manager and concrete validator implementations. The system provides a foundation for input validation with extensible validator classes.
Key changes:
- Introduces a BaseValidator abstract class as the foundation for all validators
- Implements ValidatorManager to handle collections of validators and coordinate validation
- Adds IsEmptyStringValidator as a concrete validator implementation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
BaseValidator.ts | Abstract base class defining the validator interface |
ValidatorManager.ts | Manager class for handling collections of validators and orchestrating validation |
IsEmptyStringValidator.ts | Concrete validator implementation for empty string validation |
@@ -0,0 +1,30 @@ | |||
import BaseValidator from './BaseValidator'; | |||
|
|||
export interface ValidateReturnType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same reasoning as in: ibexa/design-system#14 (comment)
export interface ValidateReturnType { | |
export interface ValidationResult { |
} | ||
|
||
validate(value: T): ValidateReturnType { | ||
const errors = this._validators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same suggestion as in: https://github.com/ibexa/design-system/pull/14/files#r2287934977
export default abstract class BaseValidator<T> { | ||
abstract getErrorMessage(): string; | ||
|
||
abstract validate(_value: T): boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why underscore? 🤔
abstract validate(_value: T): boolean; | |
abstract validate(value: T): boolean; |
Description:
For QA:
Documentation: