Skip to content

Commit fecd14a

Browse files
committed
fixup! chore(snippet-manager): migrate from joi to zod MONGOSH-2010
1 parent 48f3b4f commit fecd14a

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/snippet-manager/src/snippet-manager.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,10 @@ describe('SnippetManager', function () {
440440
await snippetManager.runSnippetCommand(['refresh']);
441441
expect.fail('missed exception');
442442
} catch (err: any) {
443-
expect(err.message).to.equal(
444-
`The specified index file ${indexURL} is not a valid index file: "indexFileVersion" must be less than or equal to 1`
443+
expect(err.message).to.include(
444+
`The specified index file ${indexURL} is not a valid index file:`
445445
);
446+
expect(err.message).to.include(`Number must be less than or equal to 1`);
446447
}
447448
});
448449

packages/snippet-manager/src/snippet-manager.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,16 @@ const indexDescriptionSchema = z.object({
5555
description: z.string(),
5656
license: z.string(),
5757
readme: z.string(),
58-
errorMatchers: z.array(errorMatcherSchema),
58+
errorMatchers: z.array(errorMatcherSchema).optional(),
5959
});
6060
const indexFileSchema = z.object({
6161
indexFileVersion: z.number().int().max(1),
6262

63-
metadata: z.object({
64-
homepage: z.string(),
65-
}),
63+
metadata: z
64+
.object({
65+
homepage: z.string(),
66+
})
67+
.passthrough(),
6668

6769
index: z.array(indexDescriptionSchema),
6870
});

0 commit comments

Comments
 (0)