import { ValidationError } from '~/domain/entities/validation-error'; export interface IAnySchema { // readonly schemaDescriptor: symbol; readonly type: T; readonly rules: IAnySchemaRules; /** * Check if the value is not valid * * @param {unknown} value - the value to be validated * * @returns {string|null} * if there's an error, return a string message * if there's no error, return null */ validate: (value: unknown) => ValidationError | null; } export interface IAnySchemaRules { readonly required?: boolean; } export abstract class BaseSchema { public static SCHEMA_DESCRIPTOR: symbol = Symbol('schema-descriptor'); protected readonly descriptor: symbol = BaseSchema.SCHEMA_DESCRIPTOR; }