Skip to content

IBX-10471: [Inputs] Inputs Validators Base#9

Merged
dew326 merged 3 commits intomainfrom
IBX-10471
Aug 25, 2025
Merged

IBX-10471: [Inputs] Inputs Validators Base#9
dew326 merged 3 commits intomainfrom
IBX-10471

Conversation

@GrabowskiM
Copy link
Copy Markdown
Contributor

🎫 Issue IBX-10471

Description:

For QA:

Documentation:

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

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 {
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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;
Copy link
Copy Markdown

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
@dew326 dew326 merged commit ab66a8f into main Aug 25, 2025
4 checks passed
@dew326 dew326 deleted the IBX-10471 branch August 25, 2025 08:48
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.

6 participants