Home/Documentation/Core Package

Core Public API

ValidationPolicy

export interface ValidationPolicy {
  addValidations(helper: ValidatorHelper): Validator[];
}

ValidatorHelper

const validator = new ValidatorHelper().validateFor('profile.email');

validateFor sets the target path and optional dependency.

Validator

helper.validateFor('email')
  .isRequired('Email is required')
  .isEmail('Enter a valid email address');

Result contracts

type ValidationResult = {
  propertyName: string;
  error: { message: string };
};

type RequiredResult = {
  propertyName: string;
  isRequired: boolean;
  hasRequiredError: boolean;
};

Metadata helpers

import {
  clearTouchedFieldsForPrefix,
  getValidationMeta,
  markFieldTouched,
  resetValidationMeta,
  shouldShowFieldErrors
} from '@validation-rules-engine/core';

Most applications use these indirectly through Angular directives or React hooks.

Continue in the live platform

Open Vanilla JS ShowcaseRun the same Core policies with framework-free TypeScript forms →Open PortalLaunch documentation and every showcase from one place →