stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StellaOps.PolicyAuthoritySignals.Contracts;
|
||||
|
||||
public sealed record PolicyContract
|
||||
{
|
||||
[JsonPropertyName("policyId")]
|
||||
public string PolicyId { get; init; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("version")]
|
||||
public string Version { get; init; } = "0.1-draft";
|
||||
|
||||
[JsonPropertyName("rulesHash")]
|
||||
public string? RulesHash { get; init; }
|
||||
}
|
||||
|
||||
public sealed record TenantScope
|
||||
{
|
||||
[JsonPropertyName("tenantId")]
|
||||
public string TenantId { get; init; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("scopes")]
|
||||
public IReadOnlyList<string> Scopes { get; init; } = Array.Empty<string>();
|
||||
}
|
||||
|
||||
public sealed record SignalSymbol
|
||||
{
|
||||
[JsonPropertyName("symbolId")]
|
||||
public string SymbolId { get; init; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("language")]
|
||||
public string? Language { get; init; }
|
||||
|
||||
[JsonPropertyName("package")]
|
||||
public string? Package { get; init; }
|
||||
|
||||
[JsonPropertyName("version")]
|
||||
public string? Version { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StellaOps.PolicyAuthoritySignals.Contracts;
|
||||
|
||||
public sealed record PolicyContract
|
||||
{
|
||||
private string _policyId = string.Empty;
|
||||
|
||||
[JsonPropertyName("policyId")]
|
||||
public string PolicyId
|
||||
{
|
||||
get => _policyId;
|
||||
init => _policyId = RequireNonEmpty(value, nameof(PolicyId));
|
||||
}
|
||||
|
||||
[JsonPropertyName("version")]
|
||||
public string Version { get; init; } = "0.1-draft";
|
||||
|
||||
[JsonPropertyName("rulesHash")]
|
||||
public string? RulesHash { get; init; }
|
||||
|
||||
public PolicyContract(string policyId, string? version = null, string? rulesHash = null)
|
||||
{
|
||||
PolicyId = policyId;
|
||||
if (!string.IsNullOrWhiteSpace(version))
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
RulesHash = rulesHash;
|
||||
}
|
||||
|
||||
private static string RequireNonEmpty(string value, string paramName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
throw new ArgumentException("Value cannot be null or whitespace.", paramName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StellaOps.PolicyAuthoritySignals.Contracts;
|
||||
|
||||
public sealed record SignalSymbol
|
||||
{
|
||||
private string _symbolId = string.Empty;
|
||||
|
||||
[JsonPropertyName("symbolId")]
|
||||
public string SymbolId
|
||||
{
|
||||
get => _symbolId;
|
||||
init => _symbolId = RequireNonEmpty(value, nameof(SymbolId));
|
||||
}
|
||||
|
||||
[JsonPropertyName("language")]
|
||||
public string? Language { get; init; }
|
||||
|
||||
[JsonPropertyName("package")]
|
||||
public string? Package { get; init; }
|
||||
|
||||
[JsonPropertyName("version")]
|
||||
public string? Version { get; init; }
|
||||
|
||||
public SignalSymbol(string symbolId, string? language = null, string? package = null, string? version = null)
|
||||
{
|
||||
SymbolId = symbolId;
|
||||
Language = language;
|
||||
Package = package;
|
||||
Version = version;
|
||||
}
|
||||
|
||||
private static string RequireNonEmpty(string value, string paramName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
throw new ArgumentException("Value cannot be null or whitespace.", paramName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -9,3 +9,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
|
||||
| AUDIT-0097-T | DONE | Revalidated 2026-01-08; test coverage audit for PolicyAuthoritySignals.Contracts. |
|
||||
| AUDIT-0097-A | TODO | Pending approval (revalidated 2026-01-08). |
|
||||
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
||||
| REMED-08 | DONE | Split contracts into separate files; added required identifier validation + contract tests (2026-02-03). |
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StellaOps.PolicyAuthoritySignals.Contracts;
|
||||
|
||||
public sealed record TenantScope
|
||||
{
|
||||
private string _tenantId = string.Empty;
|
||||
private IReadOnlyList<string> _scopes = Array.Empty<string>();
|
||||
|
||||
[JsonPropertyName("tenantId")]
|
||||
public string TenantId
|
||||
{
|
||||
get => _tenantId;
|
||||
init => _tenantId = RequireNonEmpty(value, nameof(TenantId));
|
||||
}
|
||||
|
||||
[JsonPropertyName("scopes")]
|
||||
public IReadOnlyList<string> Scopes
|
||||
{
|
||||
get => _scopes;
|
||||
init => _scopes = value ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
public TenantScope(string tenantId, IReadOnlyList<string>? scopes = null)
|
||||
{
|
||||
TenantId = tenantId;
|
||||
Scopes = scopes ?? Array.Empty<string>();
|
||||
}
|
||||
|
||||
private static string RequireNonEmpty(string value, string paramName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
throw new ArgumentException("Value cannot be null or whitespace.", paramName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user