Greeva.Domain.Validator 1.0.5

dotnet add package Greeva.Domain.Validator --version 1.0.5
                    
NuGet\Install-Package Greeva.Domain.Validator -Version 1.0.5
                    
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="Greeva.Domain.Validator" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Greeva.Domain.Validator" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="Greeva.Domain.Validator" />
                    
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 Greeva.Domain.Validator --version 1.0.5
                    
#r "nuget: Greeva.Domain.Validator, 1.0.5"
                    
#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 Greeva.Domain.Validator@1.0.5
                    
#: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=Greeva.Domain.Validator&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=Greeva.Domain.Validator&version=1.0.5
                    
Install as a Cake Tool

Greeva.Domain.Validator

FluentValidation-based domain model validators for Greeva electronic invoicing library.

Overview

Greeva.Domain.Validator provides comprehensive validation rules for all domain models in the Greeva electronic invoicing system using FluentValidation framework.

Key Features

  • FluentValidation Integration: Modern, fluent validation rules
  • SUNAT Compliance: Validation rules based on SUNAT requirements
  • Comprehensive Coverage: Validators for all document types
  • Custom Rules: Peruvian-specific validation logic (RUC, DNI, etc.)
  • Cascading Validation: Automatic validation of nested objects

Validators Included

Document Validators

  • InvoiceValidator: Invoice document validation
  • NoteValidator: Credit/Debit note validation
  • SummaryValidator: Daily summary validation
  • VoidedValidator: Voided document validation
  • DespatchValidator: Despatch guide validation

Entity Validators

  • CompanyValidator: Company information validation
  • ClientValidator: Customer information validation
  • AddressValidator: Address validation with ubigeo
  • DocumentValidator: Document reference validation

Detail Validators

  • InvoiceDetailValidator: Invoice line item validation
  • NoteDetailValidator: Note line item validation
  • SummaryDetailValidator: Summary line validation
  • DespatchDetailValidator: Despatch item validation

Usage

using FluentValidation;
using Greeva.Domain.Validator.Validators.v12;
using Greeva.Core.Domain.Sale;

// Validate an invoice
var invoice = new Invoice { /* ... */ };
var validator = new InvoiceValidator();
var result = validator.Validate(invoice);

if (!result.IsValid)
{
    foreach (var error in result.Errors)
    {
        Console.WriteLine($"Error: {error.PropertyName} - {error.ErrorMessage}");
    }
}

// Validate with specific rules
var validationResult = await validator.ValidateAsync(invoice, 
    options => options.IncludeRuleSets("BasicValidation"));

Validation Rules

Company Validation

  • RUC format validation (11 digits)
  • Required business name
  • Valid address structure
  • Legal representative information

Client Validation

  • Document type validation (DNI, RUC, etc.)
  • Document number format validation
  • Required customer name
  • Address validation when required

Invoice Validation

  • Document series and number format
  • Currency code validation
  • Tax calculations verification
  • Required fields validation
  • Business rule compliance

Amount Validation

  • Decimal precision validation
  • Tax rate validation
  • Total calculations verification
  • Currency consistency

Custom Validation Rules

// RUC validation
RuleFor(x => x.Ruc)
    .NotEmpty()
    .WithMessage("RUC is required")
    .Length(11)
    .WithMessage("RUC must be 11 digits")
    .Must(BeValidRuc)
    .WithMessage("Invalid RUC format");

// DNI validation  
RuleFor(x => x.NumDoc)
    .Length(8)
    .When(x => x.TipoDoc == "1")
    .WithMessage("DNI must be 8 digits");

// Tax calculation validation
RuleFor(x => x)
    .Must(HaveValidTaxCalculation)
    .WithMessage("Tax calculation is incorrect");

Error Messages

All validation error messages are in Spanish to comply with SUNAT requirements:

  • "El RUC es requerido"
  • "La serie debe tener el formato correcto"
  • "El cálculo de impuestos es incorrecto"
  • "La fecha de emisión no puede ser futura"

Dependencies

  • .NET 8.0
  • FluentValidation 12.0.0
  • Greeva.Core (domain models)
  • Greeva.Core: Core domain models
  • Greeva.Ubl.Validator: UBL XML schema validation
  • Greeva.WebApi: Web API integration with validation

License

MIT License - see LICENSE file for details.

Support

For issues and questions, please visit: https://github.com/augustoteles/greeva/issues

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Greeva.Domain.Validator:

Package Downloads
Greeva.WebApi

Greeva library optimized for Web APIs with DI support and embedded templates

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 279 11/21/2025
1.0.4 423 11/18/2025
1.0.3 297 11/13/2025
1.0.1 152 10/24/2025
1.0.0 198 10/12/2025