Add json schema for `fly.toml`
Closed this issue · 7 comments
With tools like Even better toml (VScode extension) you can add auto completions and validation to toml files by using adding a json schema to a file type
Having a json schema file link in the docs would be super helpful
Then you could add the following config to VScode to have autocompletions in fly.toml
{
"evenBetterToml.schema.associations": {
".*fly\\.toml": "https://fly.io/fly_toml.schema.json"
}
}
You could also add your schema to this directory and fly.toml
files would automatically get validation and auto completion to anyone with Even better toml installed
Thanks! I was just thinking about how to go about this. I'm giving it a try now. Are you able to use local file://
references in the config? I haven't gotten that to work yet for debugging.
I got a poc working adding a .vscode/settings.json
with
{
"evenBetterToml.schema.associations": {
".*fly\\.toml": "file:///Users/morse/Documents/GitHub/docs-from-notion/fly_toml.schema.json"
}
}
Try editing the file to start the extension or run "Reload window"
Nice, that works. Are you interested in contributing a full schema?
If you already have a kitchen sink fly.toml
with all the fields used you can use a tool like quicktype to generate the schema from the json
Also, for the regex it would be better to use .*fly(.*)?\\.toml
to also match fly.production.toml
https://regex101.com/r/CJ1NPu/1
Started one out here. So far it works pretty well. Thanks for the tip.
This was merged into Taplo, so is now available automatically by installing Even Better TOML.