Skip to content

changespec/changespec-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

changespec-ts

TypeScript/JavaScript types and validator for ChangeSpec 1.0 events.

Published as @changespec/changespec on npm.

Install

npm install @changespec/changespec

Requires Node.js 18+ or any modern runtime with ESM support.

Usage

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);

API

  • validate(data: unknown): ValidationResult - returns { ok: true, event } or { ok: false, errors }
  • validateOrThrow(data: unknown): ParsedEvent - throws ZodError on invalid input
  • EventSchema - Zod schema for direct use or composition
  • Category, Severity, SourceType, ReviewerRole - string literal union types

Specification

ChangeSpec 1.0 - github.com/changespec/spec

License

Apache 2.0

About

TypeScript/JavaScript types and validator for ChangeSpec 1.0 events

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors