JAAvila.FluentOperations.Grpc 1.5.0

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

JAAvila.FluentOperations.Grpc

gRPC server interceptor integration for JAAvila.FluentOperations Quality Blueprints. Provides automatic request validation with structured error metadata in gRPC trailers.

Installation

dotnet add package JAAvila.FluentOperations.Grpc

Usage

1. Define a Quality Blueprint

public class CreateOrderBlueprint : QualityBlueprint<CreateOrderRequest>
{
    public CreateOrderBlueprint()
    {
        using (Define())
        {
            For(x => x.ProductId).Test().NotBeNull().NotBeEmpty();
            For(x => x.Quantity).Test().BePositive();
        }
    }
}

2. Register services

// Program.cs
builder.Services.AddSingleton<CreateOrderBlueprint>();
builder.Services.AddSingleton<IBlueprintValidator>(sp =>
    sp.GetRequiredService<CreateOrderBlueprint>());

// Register the interceptor (with optional configuration)
builder.Services.AddGrpcBlueprintValidation(options =>
{
    options.FailureStatusCode = StatusCode.InvalidArgument;
    options.IncludeReportInTrailers = true;
    options.StreamValidation = StreamValidationMode.FirstMessageOnly;
});

// Enable the interceptor on all gRPC services
builder.Services.AddGrpc(options =>
{
    options.Interceptors.Add<GrpcBlueprintInterceptor>();
});

3. Validation behavior

When a request fails validation, the interceptor throws an RpcException with:

  • Status code: configured via FailureStatusCode (default: InvalidArgument)
  • Status message: "Validation failed with N error(s)."
  • Metadata entries: one validation-error-{propertyname} entry per Error-level failure message
  • Binary trailer (validation-errors-bin): JSON-serialized error dictionary (when IncludeReportInTrailers = true)

Only Severity.Error failures block the call. Warning and Info failures are not included in error metadata.

Streaming modes

The StreamValidation option controls validation on client-streaming and duplex-streaming calls:

Mode Behavior
FirstMessageOnly (default) Validates only the first message; subsequent messages pass through
EveryMessage Validates every message on the stream
Skip No validation for streaming calls

Server-streaming calls validate the single request message the same way as unary calls.

Example client error handling

try
{
    await client.CreateOrderAsync(request);
}
catch (RpcException ex) when (ex.StatusCode == StatusCode.InvalidArgument)
{
    // Read per-property errors from metadata
    var productErrors = ex.Trailers.GetAll("validation-error-productid");

    // Or read the full JSON dictionary from the binary trailer
    var entry = ex.Trailers.Get("validation-errors-bin");
    if (entry is not null)
    {
        var errors = JsonSerializer.Deserialize<Dictionary<string, string[]>>(entry.ValueBytes);
    }
}
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

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.5.0 91 3/29/2026
1.3.0 88 3/26/2026
1.1.0 91 3/21/2026