Cerbi.CerbiShield.Contracts 0.2.0

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

Cerbi.Contracts

Canonical scoring contracts shared between logger adapters, the Scoring API, and any analytics services that need to understand scoring payloads.

Installation

Add the package reference (after publishing to your feed) to any producer or consumer that needs to understand scoring payloads:

<ItemGroup>
  <PackageReference Include="Cerbi.CerbiShield.Contracts" Version="0.1.0" />
</ItemGroup>

Usage

Reference the DTOs when producing payloads and keep ContractVersions in sync so consumers can branch safely:

using Cerbi.Contracts.Contracts;

var payload = new ScoringEventDto
{
    SchemaVersion = ContractVersions.ScoringEventSchemaVersion,
    AppName = "ScoringWorker",
    TimestampUtc = DateTime.UtcNow,
    Score = new ScoreBreakdownDto { Overall = 88 }
};

var envelope = new ScoringQueueEnvelopeDto
{
    EnvelopeVersion = ContractVersions.ScoringEnvelopeVersion,
    EnqueuedUtc = DateTime.UtcNow,
    Payload = payload
};

Emit the DTOs as JSON using the exact property names defined in the contracts so downstream analytics services can deserialize reliably.

JSON serialization rules

  • Payloads use the property names defined in the DTOs; do not rely on runtime naming policies to rename fields.
  • If a service enforces camelCase serialization, apply explicit JsonPropertyName attributes locally so the JSON produced matches these contract names.
  • Nullable properties must be emitted as null rather than dropped whenever the value is unknown.
  • All timestamps represent UTC instants using ISO-8601 strings.
  • The queue envelope always sets MessageType to "scoring-event" and includes EnvelopeVersion for forward compatibility.

Contract reference

DTO Key properties
ScoringEventDto SchemaVersion, TenantId, AppName, optional Environment, Runtime, CorrelationId, LogId, GovernanceProfile, GovernanceMode, LogLevel, Score, Violations, and GovernanceFlags
ScoringQueueEnvelopeDto EnvelopeVersion, constant MessageType, producer metadata, and the scoring payload
ScoreBreakdownDto Optional numeric buckets for Overall, Governance, and Safety
ViolationDto Optional RuleId, Code, Field, Severity, and Message annotations
GovernanceFlagsDto GovernanceRelaxed indicates whether mitigations were applied
ContractVersions Canonical version integers for schema/envelope coordination

Versioning

  • ContractVersions.ScoringEventSchemaVersion and ContractVersions.ScoringEnvelopeVersion are the canonical integers to bump when the payload schema or envelope changes.
  • Producers should populate ScoringEventDto.SchemaVersion and ScoringQueueEnvelopeDto.EnvelopeVersion with these constants so consumers can branch safely.

Breaking changes

  • Any DTO rename, removal, or property shape change requires bumping the relevant constant in ContractVersions.
  • Update the contract-lock tests to pin the serialized JSON property names and version fields before publishing.
  • Communicate version bumps to all producers/consumers and republish the package Cerbi.CerbiShield.Contracts.

Testing

Run dotnet test tests/Cerbi.Contracts.Tests/Cerbi.Contracts.Tests.csproj to validate the DTO defaults and round-trip behavior before publishing a package.

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 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 is compatible.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Cerbi.CerbiShield.Contracts:

Package Downloads
Cerbi.MEL.Governance

Real-time governance enforcement for Microsoft.Extensions.Logging (MEL) using the Cerbi validation engine.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 432 2/4/2026
0.1.0 1,854 12/15/2025