Skip to content

Commit 9b98cc3

Browse files
thomasballingerConvex, Inc.
authored andcommitted
allow $schema in convex.json (#43249)
Stop warning when unrecognized key `"$schema"` is found in convex.json GitOrigin-RevId: c696b487f585c7215ace5412455ba9f6f20b8d6b
1 parent d55a7e7 commit 9b98cc3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/cli/lib/config.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,4 +941,14 @@ test("parseProjectConfig - warns about unknown properties", async () => {
941941
const stderr4 = stderrSpy.mock.calls.map((call) => call[0]).join("");
942942
expect(stripVTControlCharacters(stderr4)).not.toContain("Warning");
943943
expect(stripVTControlCharacters(stderr4)).not.toContain("Unknown");
944+
945+
// No warning for $schema field (used by JSON schema validation)
946+
stderrSpy.mockClear();
947+
await parseProjectConfig(ctx, {
948+
functions: "convex/",
949+
$schema: "../../../convex/schemas/convex.schema.json",
950+
});
951+
const stderr5 = stderrSpy.mock.calls.map((call) => call[0]).join("");
952+
expect(stripVTControlCharacters(stderr5)).not.toContain("Warning");
953+
expect(stripVTControlCharacters(stderr5)).not.toContain("Unknown");
944954
});

src/cli/lib/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ const createProjectConfigSchema = (strict: boolean) => {
205205
}),
206206
generateCommonJSApi: z.boolean().default(false),
207207

208+
// Optional $schema field for JSON schema validation in editors
209+
$schema: z.string().optional(),
210+
208211
// Deprecated fields that have been deprecated for years, only here so we
209212
// know it's safe to delete them.
210213
project: z.string().optional(),

0 commit comments

Comments
 (0)