diff --git a/httpd-client/lib/project/commit.ts b/httpd-client/lib/project/commit.ts index 3610a9610..ee642f542 100644 --- a/httpd-client/lib/project/commit.ts +++ b/httpd-client/lib/project/commit.ts @@ -98,30 +98,28 @@ const diffContentSchema = object({ ]), }); -type DiffAddedChangeset = z.infer; - -const diffAddedChangesetSchema = object({ +const diffChangesetSchema = object({ path: string(), diff: diffContentSchema, - new: diffFileSchema, }); +type DiffAddedChangeset = z.infer; + +const diffAddedChangesetSchema = diffChangesetSchema.merge( + object({ new: diffFileSchema }), +); + type DiffDeletedChangeset = z.infer; -const diffDeletedChangesetSchema = object({ - path: string(), - diff: diffContentSchema, - old: diffFileSchema, -}); +const diffDeletedChangesetSchema = diffChangesetSchema.merge( + object({ old: diffFileSchema }), +); type DiffModifiedChangeset = z.infer; -const diffModifiedChangesetSchema = object({ - path: string(), - diff: diffContentSchema, - new: diffFileSchema, - old: diffFileSchema, -}); +const diffModifiedChangesetSchema = diffChangesetSchema.merge( + object({ new: diffFileSchema, old: diffFileSchema }), +); type DiffCopiedChangeset = z.infer;