feat(reporting-governance): enforce decision artifact schema formats
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user