Files
git.stella-ops.org/src/Policy/StellaOps.Policy.RiskProfile/Validation/RiskProfileValidator.cs
StellaOps Bot 8d78dd219b
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
feat(advisory-ai): Add deployment guide, Dockerfile, and Helm chart for on-prem packaging
- Introduced a comprehensive deployment guide for AdvisoryAI, detailing local builds, remote inference toggles, and scaling guidance.
- Created a multi-role Dockerfile for building WebService and Worker images.
- Added a docker-compose file for local and offline deployment.
- Implemented a Helm chart for Kubernetes deployment with persistence and remote inference options.
- Established a new API endpoint `/advisories/summary` for deterministic summaries of observations and linksets.
- Introduced a JSON schema for risk profiles and a validator to ensure compliance with the schema.
- Added unit tests for the risk profile validator to ensure functionality and error handling.
2025-11-23 00:35:33 +02:00

31 lines
791 B
C#

using System.Text.Json;
using Json.Schema;
using StellaOps.Policy.RiskProfile.Schema;
namespace StellaOps.Policy.RiskProfile.Validation;
public sealed class RiskProfileValidator
{
private readonly JsonSchema _schema;
public RiskProfileValidator() : this(RiskProfileSchemaProvider.GetSchema())
{
}
public RiskProfileValidator(JsonSchema schema)
{
_schema = schema ?? throw new ArgumentNullException(nameof(schema));
}
public ValidationResults Validate(string json)
{
if (string.IsNullOrWhiteSpace(json))
{
throw new ArgumentException("Risk profile payload is required.", nameof(json));
}
using var document = JsonDocument.Parse(json);
return _schema.Validate(document.RootElement);
}
}