← Files AixcutARCHIVED FILE
scripts/validate-contract.mjs
540 Bytes · Nov 6, 2026 · 07:28 UTC
import * as validators from './schema-validators.mjs';
import { semanticErrors } from './contract-semantics.mjs';
/** Portable generated schema + shared semantics. No repository/development dependency. */
export function validateContract(name, value) {
const validate = validators[name.replaceAll('-', '_')];
if (typeof validate !== 'function') return ['unknown contract: ' + name];
if (!validate(value)) return validate.errors.map(error => (error.instancePath || '/') + ' ' + error.message);
return semanticErrors(name, value);
}
SHA-256: be29525286f3aef7e3675b63f7f3234c472dd9e0223969eb2c75f1132209c352