Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

GrabowskiM
Copy link
Contributor

🎫 Issue IBX-10471

Description:

For QA:

Documentation:

@GrabowskiM GrabowskiM requested a review from Copilot August 7, 2025 14:35
Copy link

@Copilot Copilot AI left a 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

@GrabowskiM GrabowskiM requested a review from a team August 7, 2025 14:37
@@ -0,0 +1,30 @@
import BaseValidator from './BaseValidator';

export interface ValidateReturnType {

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)

Suggested change
export interface ValidateReturnType {
export interface ValidationResult {

}

validate(value: T): ValidateReturnType {
const errors = this._validators

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export default abstract class BaseValidator<T> {
abstract getErrorMessage(): string;

abstract validate(_value: T): boolean;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why underscore? 🤔

Suggested change
abstract validate(_value: T): boolean;
abstract validate(value: T): boolean;

@GrabowskiM GrabowskiM requested a review from tischsoic August 22, 2025 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants