Skip to content

Commit ae32218

Browse files
devin-ai-integration[bot]Convex, Inc.
authored andcommitted
Add JSON schema for convex.json configuration (#35617)
This PR adds a JSON schema for the convex.json configuration file to provide editor validation and autocompletion. The schema includes support for: - node.externalPackages - generateCommonJSApi - functions path Documentation has been updated to reference the schema. GitOrigin-RevId: 6779298e35076a250c1c85fb925ac67556f39740
1 parent d150660 commit ae32218

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"description": "Configuration schema for Convex project settings.\n\nDocumentation: https://docs.convex.dev/production/project-configuration#convexjson",
4+
"type": "object",
5+
"properties": {
6+
"$schema": {
7+
"type": "string"
8+
},
9+
"node": {
10+
"type": "object",
11+
"description": "Node.js specific configuration for server-side packages and dependencies.",
12+
"properties": {
13+
"externalPackages": {
14+
"type": ["array"],
15+
"description": "List of packages that should be installed on the server instead of being bundled. Use this for packages that can't be bundled or need to be installed directly on the server.\n\nIf you want to mark all dependencies as external, you can use the string '*' instead of an array.\n\nDocumentation: https://docs.convex.dev/functions/bundling#external-packages",
16+
"items": {
17+
"type": "string"
18+
},
19+
"default": ["*"],
20+
"oneOf": [
21+
{
22+
"contains": {
23+
"const": "*"
24+
},
25+
"maxItems": 1
26+
},
27+
{
28+
"not": {
29+
"contains": {
30+
"const": "*"
31+
}
32+
}
33+
}
34+
]
35+
}
36+
}
37+
},
38+
"generateCommonJSApi": {
39+
"type": "boolean",
40+
"description": "When true, generates CommonJS-compatible API files for projects not using ES modules. Enable this if your project uses require() syntax instead of ES modules.\n\nDocumentation: https://docs.convex.dev/client/javascript/node#javascript-with-commonjs-require-syntax",
41+
"default": false
42+
},
43+
"functions": {
44+
"type": "string",
45+
"description": "Path to the directory containing Convex functions. You can customize this to use a different location than the default 'convex/' directory.\n\nDocumentation: https://docs.convex.dev/production/project-configuration#changing-the-convex-folder-name-or-location",
46+
"default": "convex/"
47+
}
48+
},
49+
"additionalProperties": false
50+
}

npm-packages/docs/docs/production/project-configuration.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ same project as your configured development `CONVEX_DEPLOYMENT`.
3636
Additional project configuration can be specified in the `convex.json` file in
3737
the root of your project (in the same directory as your `package.json`).
3838

39+
You can use the JSON schema for editor validation by adding a `$schema`
40+
property:
41+
42+
```json title="convex.json"
43+
{
44+
"$schema": "https://raw.githubusercontent.com/get-convex/convex-backend/refs/heads/main/npm-packages/convex/schemas/convex.schema.json",
45+
"functions": "src/convex/"
46+
}
47+
```
48+
3949
The file supports the following configuration options:
4050

4151
### Changing the `convex/` folder name or location

0 commit comments

Comments
 (0)