TypeScript/JavaScript types and validator for ChangeSpec 1.0 events.
Published as @changespec/changespec on npm.
npm install @changespec/changespecRequires Node.js 18+ or any modern runtime with ESM support.
import { validate } from "@changespec/changespec";
const result = validate(rawJson);
if (result.ok) {
console.log(result.event.vendor_id);
console.log(result.event.category);
} else {
console.error(result.errors);
}Throws on invalid input:
import { validateOrThrow } from "@changespec/changespec";
const event = validateOrThrow(rawJson);validate(data: unknown): ValidationResult- returns{ ok: true, event }or{ ok: false, errors }validateOrThrow(data: unknown): ParsedEvent- throwsZodErroron invalid inputEventSchema- Zod schema for direct use or compositionCategory,Severity,SourceType,ReviewerRole- string literal union types
ChangeSpec 1.0 - github.com/changespec/spec
Apache 2.0