Add OpenABTest draft experiment and accounting contracts (#180)

This commit is contained in:
Anthony Ettinger 2026-09-13 02:17:35 -07:00 • committed by GitHub
parent 123ba2e39a
commit d8b3126782
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 1410 additions and 12 deletions

View file

@ -3,6 +3,7 @@ import * as addFormatsModule from "ajv-formats";
import type { ErrorObject } from "ajv";
import { parse } from "yaml";
import { isSchemaKind, schemas, type SchemaKind } from "./schemas.js";
import { validateOpenABTest } from "./openabtest.js";
import { validateOpenRentalReferences } from "./openrental.js";
type CompiledSchema = { (data: unknown): boolean; errors?: ErrorObject[] | null };
@ -66,6 +67,10 @@ export function validate(kind: SchemaKind, data: unknown): ValidationResult {
const errors = validateOpenRentalReferences(data);
if (errors.length) return { ok: false, kind, errors };
}
if (kind === "openabtest-manifest" || kind === "openabtest-event") {
const errors = validateOpenABTest(kind, data);
if (errors.length) return { ok: false, kind, errors };
}
return { ok: true, kind, data };
}