Validating `pricing.json` Files in the IDE #
This is a quick guide for adding the schema for
pricing.json files to
vim and VSCode.
TL;DR #
The schema for pricing.json files is available at
https://www.tier.run/docs/pricing.schema.json. Plug that URL into
whatever tool you use to validate JSON, and associate it with
pricing.json files.
VS Code #
More info on editing JSON is available in the VSCode docs.
-
Open the User and Workspace Settings menu.
-
Click
Extensionsand thenJSONin the left sidebar. -
Look for the option "JSON > Schema Download: Enable" and ensure that the box is checked.
-
Underneath that, look for the option "JSON: Schemas" and click "Edit in settings.json"
-
Add the following section:
"json.schemas": [ { "fileMatch": ["pricing.json"], "url": "https://www.tier.run/docs/pricing.schema.json" } ],
Here's the result:
vim/neovim and COC #
If you use vim with COC, you can add support for validating pricing.json files like so:
-
Ensure that
coc-jsonis enabled. You can do this by running:CocInstall coc-jsonor by having something like the following in your~/.vimrc:let g:coc_global_extensions = ['coc-json'] -
Run
:CocConfigto option the configuration file for coc. (By default this is~/.config/nvim/coc-settings.json.) -
Add the following field to the object there (if it already exists) or add it as a new top level object:
{ "json.schemas": [ { "fileMatch": ["pricing.json"], "url": "https://www.tier.run/docs/pricing.schema.json" } ] }
Here's what it looks like in action:
That's it!