Validixty 1.0.0
See the version list below for details.
dotnet add package Validixty --version 1.0.0
NuGet\Install-Package Validixty -Version 1.0.0
<PackageReference Include="Validixty" Version="1.0.0" />
<PackageVersion Include="Validixty" Version="1.0.0" />
<PackageReference Include="Validixty" />
paket add Validixty --version 1.0.0
#r "nuget: Validixty, 1.0.0"
#:package Validixty@1.0.0
#addin nuget:?package=Validixty&version=1.0.0
#tool nuget:?package=Validixty&version=1.0.0
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 validatorsValidationPipeline- Composable validation workflowsSmartValidator- AI-assisted input type detectionBulkValidation- Collection and object validationConditionalValidation- Context-aware validation rulesLocalizationManager- Multi-language supportValidationTemplates- Pre-built validation scenariosValidationCodeGenerator- Code generation utilities
Extension Methods
ValidateDataAnnotations()- DataAnnotations integrationIsValidWithMonitoring()- Performance-monitored validationValidateCollectionAsync()- 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
- Add new validators to appropriate category folders
- Include comprehensive unit tests
- Update README.md with new features
- Follow existing naming conventions
- Ensure all code compiles without warnings
License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions 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. |
-
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.