Getting a better experience with JSON/YAML configuration

TL;DR caddy-json-schema can give you an IDE-like experience when working with Caddy JSON and YAML config.

When Caddy v2 was announced, one of the most notable changes is the use of JSON as the native configuration language.

While some people are not open to the change and will rather keep using Caddyfile, there are others like me who wants to give JSON config a shot but somehow did not find it as easy as desired.

I took some time out to make the experience better for myself and other Caddy enthusiasts and I came up with caddy-json-schema. A JSON schema generator for Caddy v2 that can be integrated with editors to get suggestions and documentation.

Here is a demo of it in action.

I have only tested it with the editors I use personally, VSCode and Vim (with coc-json plugin). But I expect it to work with any editor that supports the use of JSON schema for intellisense.

Looking forward to hearing feedbacks from those that tried it out.

Update

I found out JSON schemas can also be used for YAML files and the project docs have been updated to reflect it.

12 Likes

Pinning this for a few days because I think this is super handy!

I am using it myself because although our online JSON docs are actually quite good, nothing really beats having the editor show it for you as you’re typing. I estimate that this accelerates my config editing by about 2-5x (and this is coming from someone who is more familiar with it than anyone else).

This should lower the “fear” factor that people have when approaching JSON configs quite a bit. I hope more people will use JSON to configure their servers when they need to, without being apprehensive about it, thanks to this plugin. :slight_smile:

Thank you for making this!

2 Likes

This should be an indicator that somehow a wrong turn was made with v2/JSON…

Nope. If you think so, you’ve missed the point.

Let’s keep this thread on-topic about the tool that Abiola is so graciously sharing with us for free.

This topic was automatically closed after 14 days. New replies are no longer allowed.