Luke
Luke7d ago

convex.json schema?

Hey there, I was wondering if there was a JSON schema available for the convex.json config file by chance. Does this exist? Couldn't find anything on the Convex search.
4 Replies
Convex Bot
Convex Bot7d ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Luke
LukeOP7d ago
After doing some research, it would appear that (at the moment) this doesn't exist. Given that, I went ahead and made a "community" one by scouring the Convex GitHub org and looking for all usage of convex.json. I tried to strictly type it and link out to docs to the best of my ability, although it may not be perfect. You can find the GitHub gist here, and if anyone has any alterations please let me know! You should be able to use it like this:
{
"$schema": "https://gist.githubusercontent.com/dir/945673224a85d0185f78f6f46a563320/raw/convex.schema.json",

"node": {
"externalPackages": ["*"]
}
}
{
"$schema": "https://gist.githubusercontent.com/dir/945673224a85d0185f78f6f46a563320/raw/convex.schema.json",

"node": {
"externalPackages": ["*"]
}
}
Alternatively, if you use VSCode, a cleaner solution is to set the schema in your settings.json, like so:
{
"json.schemaDownload.enable": true,
"json.schemas": [
{
"fileMatch": ["**/convex.json"],
"url": "https://gist.githubusercontent.com/dir/945673224a85d0185f78f6f46a563320/raw/convex.schema.json"
}
]
}
{
"json.schemaDownload.enable": true,
"json.schemas": [
{
"fileMatch": ["**/convex.json"],
"url": "https://gist.githubusercontent.com/dir/945673224a85d0185f78f6f46a563320/raw/convex.schema.json"
}
]
}
This solution makes it so that you don't need to do the "$schema": "...long gist url here in every convex.json file, VSCode will automatically map the schema.
sshader
sshader6d ago
It's documented in english here: https://docs.convex.dev/production/project-configuration#convexjson The one in the gist looks mostly correct (nice work!) but includes some properties that have been deprecated for a while. We can probably make an official one -- what's the use case here? Better editor support when editing the convex.json file?
ballingt
ballingt6d ago
Yeah good investigation @Luke! If you open a PR to https://github.com/get-convex/convex-js with this we'll take it! Then we'll get it submitted to https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/tsconfig.json which I think is what will make it show up automatically for folks in VSCode without needing to specify the "$schema"? not sure if that's all it takes and second sshader's question above