From 339129990c6c618f106e9998e506d92cc5a5c819 Mon Sep 17 00:00:00 2001 From: Paul Hitt Date: Mon, 28 Sep 2026 16:51:57 -0400 Subject: [PATCH] Make the README example run to the end It needs zod, which this package does not depend on, so the import now says to install it. assertFields threw on the drift the example shows on purpose, which stopped the script before the coverage part; it is now a commented alternative to the expectFields report. Co-Authored-By: Claude Opus 5.5 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a011c52..d80dcb6 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ assessed. Reports use the `@extant2000/evidence-record` format. ```ts import { assertShape, expectFields, assertFields, formatFields, coverage, formatCoverage } from '@extant2000/contract-check' -import { z } from 'zod' // or any parser with a zod-style safeParse +import { z } from 'zod' // npm install zod, or use any parser with a zod-style safeParse // 1. Response shape const payload: unknown = { id: 'm1', name: 'Survey' } // e.g. a parsed response body @@ -68,7 +68,7 @@ const expectations = [ ] const result = expectFields(subscription, expectations) console.log(formatFields(result, { context: 'stripe.subscriptions.create', expectations })) -assertFields(subscription, expectations, 'stripe.subscriptions.create') // or throw +// assertFields(subscription, expectations, 'stripe.subscriptions.create') // throws ContractDriftError here instead // 3. Coverage against a floor const c = coverage(['GET /a', 'GET /b', 'POST /c', 'GET /d'], ['GET /a', 'GET /b', 'POST /c'], 80)