Validixty 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Validixty --version 1.0.0
                    
NuGet\Install-Package Validixty -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Validixty" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Validixty" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Validixty" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Validixty --version 1.0.0
                    
#r "nuget: Validixty, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Validixty@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Validixty&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Validixty&version=1.0.0
                    
Install as a Cake Tool

Validixty

A comprehensive regex-based validation library for .NET with fluent API and DataAnnotations support.

Features

  • Regex-based Validations: Built on regular expressions for fast and reliable validation
  • Fluent API: Chain multiple validations easily
  • DataAnnotations Support: Use with ASP.NET Core model validation
  • Country-specific Patterns: Support for international phone numbers, IDs, and more
  • Smart Detection: Automatically detect input types
  • Extensible: Easy to add custom validators

Installation

dotnet add package Validixty

Quick Start

Basic Usage

using Validixty.Core;

// Simple validation
bool isValid = Validation.Personal.PhoneNumber.Valid(x => x.Country == CountriesEnum.Egypt, "+201234567890");
bool isEmailValid = Validation.Communication.EmailAddress.IsValid("user@example.com");
bool isCardValid = Validation.Finance.CreditCard.IsValid("5500000000000004");

Fluent API (Validation Chain)

using Validixty.Core;

var result = Validation.For("User")
    .CheckPhone(x => x.Country == CountriesEnum.Egypt, user.Phone)
    .CheckEmail(user.Email)
    .CheckPassword(user.Password)
    .Validate();

if (!result.IsValid)
{
    // Handle validation errors
}

DataAnnotations

using Validixty.Annotations;

public class UserModel
{
    [Phone(Country = CountriesEnum.Egypt)]
    public string PhoneNumber { get; set; }

    [NationalID(Country = CountriesEnum.SaudiArabia)]
    public string NationalId { get; set; }

    [CreditCard(Type = CardTypes.Visa)]
    public string CreditCardNumber { get; set; }
}

Smart Detection

using Validixty.Core;

var smartValidator = new SmartValidator();
var result = smartValidator.Validate("+201234567890");
// result.FieldName will be "PhoneNumber"
// result.IsValid will be true

Validation Pipelines

using Validixty.Core;

var pipeline = ValidationPipeline.Create()
    .AddStep(new NameValidator(), "Name", obj => GetPropertyValue<string>(obj, "Name"))
    .AddStep(new EmailAddressValidator(), "Email", obj => GetPropertyValue<string>(obj, "Email"))
    .When(obj => !string.IsNullOrEmpty(GetPropertyValue<string>(obj, "Phone")),
          new PhoneNumberValidator(), "Phone", obj => GetPropertyValue<string>(obj, "Phone"));

var result = pipeline.Execute(userObject);

Bulk Validation

using Validixty.Core;

var users = new List<User> { user1, user2, user3 };
var result = BulkValidation.ValidateCollection(users, user => {
    // Custom validation logic
    return new ValidationResult("User", user.Name, user.IsValid, "User validation");
});

Conditional Validation

using Validixty.Core;

var result = ConditionalValidation.ValidateWithCondition(
    user,
    u => u.Age >= 18, // condition
    new EmailAddressValidator(), // validator
    u => u.Email // value selector
);

Validation Templates

using Validixty.Core;

// Use pre-built templates
var userValidation = ValidationTemplates.UserRegistration;
var paymentValidation = ValidationTemplates.PaymentProcessing;
var addressValidation = ValidationTemplates.AddressValidation;

Localization

using Validixty.Core;

// Set culture for localized messages
LocalizationManager.SetCulture("ar");

// Register custom messages
LocalizationManager.RegisterMessage("EmailAddress", "ar", "البريد الإلكتروني غير صحيح");

Supported Validators

Personal / Identity

  • PhoneNumber (with country-specific patterns)
  • NationalID (with country-specific patterns)
  • Passport (with country-specific patterns)
  • Name
  • DateOfBirth
  • GenderCode
  • SSN (US Social Security Number)
  • MaritalStatusCode
  • ResidencyID

Finance / Banking

  • CreditCard (Visa, MasterCard, Amex, etc. with Luhn validation)
  • IBAN (with checksum validation)
  • SWIFT/BIC
  • CurrencyCode (ISO 4217)
  • TaxNumber/VATNumber
  • BankAccountNumber
  • PaymentReference
  • ChequeNumber
  • TransactionID

Communication / Contact

  • EmailAddress
  • Website/URL
  • IPAddress (IPv4/IPv6)
  • MACAddress
  • SocialHandle
  • WhatsAppNumber
  • TelegramUsername

Address / Location

  • PostalCode/ZipCode
  • StreetAddress
  • City/Region/Governorate
  • Coordinates (Latitude, Longitude)
  • BuildingNumber
  • ApartmentNumber
  • CountryCode (ISO Alpha-2/Alpha-3)

System / Technical

  • UUID/GUID
  • FileName
  • FileExtension
  • Hex/Base64/SHA256
  • JsonStructure
  • XmlStructure
  • SQLInjectionCheck
  • CommandInjectionCheck
  • URLSafeString
  • HtmlTagValidator

Media / Content

  • ImageUrl (jpg, png, gif, webp, svg)
  • VideoUrl (mp4, avi, mov, wmv, flv, mkv, webm)
  • AudioUrl (mp3, wav, flac, aac, ogg, m4a)
  • MimeType
  • ColorCode (Hex, RGB, HSL formats)

Measurement / Units

  • Weight (kg, lbs, g, oz)
  • Dimension (cm, inches, m, ft)
  • Temperature (°C, °F, K)
  • Speed (km/h, mph, m/s)

Business / Documents

  • InvoiceNumber
  • LicenseNumber
  • RegistrationNumber
  • ContractCode
  • EmployeeCode
  • DocumentReference
  • ReportNumber
  • OrderNumber
  • CustomerCode

Custom / Domain-specific

  • ProductCode/SKU
  • Barcode/QRCode
  • PlateNumber (Car License)
  • TicketCode/BookingCode
  • SerialNumber
  • MachineID/DeviceID
  • ShipmentTrackingNumber
  • AirlineFlightNumber
  • HotelReservationCode

Government / Official

  • NationalTaxID
  • DrivingLicenseNumber
  • InsurancePolicyNumber
  • VoterID
  • VehicleChassisNumber (VIN)
  • ResidencyPermitNumber
  • CustomsDeclarationNumber
  • CourtCaseNumber
  • PoliceReportNumber

Textual / Linguistic

  • Username
  • PasswordStrength
  • HasArabicLetters
  • HasLatinLetters
  • ContainsNumbers
  • ContainsProfanity
  • NoSpecialCharacters
  • TitleCaseCheck
  • SentenceCaseCheck

Date / Time

  • DateFormat (dd/MM/yyyy, yyyy-MM-dd, etc.)
  • TimeFormat (HH:mm, hh:mm tt)
  • DateTimeCombined
  • ISO8601Date
  • TimeZoneCode

Advanced Features

Multi-Regex Validation

Support for multiple regex patterns for the same field type.

Regex Set Manager

Allow users to register custom regex patterns at runtime.

Validation Chain

Fluent API for complex validation scenarios with multiple fields.

Smart Validator

Automatically detects the type of input and applies appropriate validation with confidence scoring.

Validation Pipelines

Composable validation pipelines for complex workflows with conditional steps.

Bulk Validation

Validate collections and objects in bulk with detailed reporting.

Conditional Validation

Context-aware validation that depends on other field values or conditions.

Localization Support

Multi-language error messages and customizable validation messages.

Performance Optimizations

Caching, async validation, and performance monitoring for high-throughput scenarios.

Validation Templates

Pre-built templates for common scenarios (User Registration, Payment Processing, etc.).

Code Generation

Generate validators, DataAnnotations, and test cases from schemas.

API Reference

Core Classes

  • Validation - Main entry point for all validators
  • ValidationPipeline - Composable validation workflows
  • SmartValidator - AI-assisted input type detection
  • BulkValidation - Collection and object validation
  • ConditionalValidation - Context-aware validation rules
  • LocalizationManager - Multi-language support
  • ValidationTemplates - Pre-built validation scenarios
  • ValidationCodeGenerator - Code generation utilities

Extension Methods

  • ValidateDataAnnotations() - DataAnnotations integration
  • IsValidWithMonitoring() - Performance-monitored validation
  • ValidateCollectionAsync() - Async bulk validation

Performance Features

  • Caching: Validator instances and regex patterns are cached for reuse
  • Async Support: All validation operations support async execution
  • Parallel Processing: Bulk validation can use multiple threads
  • Performance Monitoring: Track validation metrics and bottlenecks
  • Compiled Regex: All patterns use compiled regex for maximum speed

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Guidelines

  1. Add new validators to appropriate category folders
  2. Include comprehensive unit tests
  3. Update README.md with new features
  4. Follow existing naming conventions
  5. Ensure all code compiles without warnings

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 279 11/12/2025
1.0.3 283 11/12/2025
1.0.2 287 11/11/2025
1.0.1 285 11/11/2025
1.0.0 304 11/11/2025