· 2 min read
Fantastic JSON Schemas and where to find them
Aren't you curious? Just in case, here's what I found!
Everytime you write a config for a common tool, for example you’re writing a GitHub Action in Visual Studio Code, you get a nice autocomplete with all the available options and documentation.
Have you ever wondered where does that come from? Ok, most likely you didn’t, I see it’s not the most exciting topic, but some days ago I was curious about it and I dug a little bit into it.
Here’s what I found out:
The problem
In short, here’s the story. I was writing the config for a GitHub Issue Template and I noticed that a field that was in the official docs was marked as invalid in my editor.
How is that even possible? I tried to commit and push it anyway and it worked so the doc was right but the editor was wrong.
I investigated a little bit and discovered that the JSON schemas used to validate most of the config we’re using are hosted on schemastore.org and in fact, the field I was trying to use was not there.
Scroll down a little bit and… there’s a public repo on GitHub where you can contribute to the schemas!
https://github.com/schemastore/schemastore/
The solution
Ok then, I know what to do now!
The documentation explains quite easily how it works, you can edit the existing JSON schema and add some tests to make sure it works as expected. Since this isn’t a new schema but I was just adding a field, everything else was already set up.
I created the PR and it got merged within a few hours. As a result, the field is now available in the schema and my editor is happy again.
Closing
And that’s it! As I said, I know it’s not as exciting as having a hot take about which js framework is best, but hey I was curious and I learned something new.
Hope you find it a tiny bit interesting and remember, stay curious!
Hello! My name is Leonardo and as you might have noticed, I like to talk about Web Development and Open Source!
I use GitHub every day and my favourite editor is Visual Studio Code... this might influence a little bit my conent! :D
If you like what I do, you should have a look at my YouTube Channel!
Let's get in touch, feel free to send me a DM on Twitter!