feat(reporting-governance): enforce decision artifact schema formats

This commit is contained in:
Eve
2026-05-08 13:56:39 +08:00
parent 0ef6fbbcc6
commit 2eaa6e3bb3
4 changed files with 77 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import fs from 'node:fs';
import path from 'node:path';
import Ajv2020 from 'ajv/dist/2020.js';
import addFormats from 'ajv-formats';
const EXPECTED_KIND = 'DecisionRecordArtifact';
const EXPECTED_API_VERSION = 'reporting-governance/v1alpha1';
@@ -24,6 +25,7 @@ const decisionSchemaPath = path.resolve(repoRoot, 'schemas', 'reporting-governan
const decisionRecordArtifactSchemaPath = path.resolve(repoRoot, 'schemas', 'reporting-governance', 'decision-record-artifact.schema.json');
const ajv = new Ajv2020({ allErrors: true, strict: false });
addFormats(ajv);
const decisionSchema = JSON.parse(fs.readFileSync(decisionSchemaPath, 'utf8'));
const decisionRecordArtifactSchema = JSON.parse(fs.readFileSync(decisionRecordArtifactSchemaPath, 'utf8'));
ajv.addSchema(decisionSchema);