DEV Community

Cover image for Fantastic JSON Schemas and where to find them
Leonardo Montini for This is Learning

Posted on • Originally published at leonardomontini.dev

Fantastic JSON Schemas and where to find them

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!

GitHub logo SchemaStore / schemastore

A collection of JSON schema files including full API

JSON Schema Store

The largest collection of independent JSON schemas in the world.

Build status CodeQL

The repository is a universal JSON schema store, where schemas for popular JSON documents can be found.

Website: schemastore.org

Contribute

Contributions are more than welcome! Both to the website itself or to the various schema files. Please carefully read CONTRIBUTING.md.




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!


Thanks for reading this article, I hope you found it interesting!

I recently launched a GitHub Community! We create Open Source projects with the goal of learning Web Development together!

Join us: https://github.com/DevLeonardoCommunity

Do you like my content? You might consider subscribing to my YouTube channel! It means a lot to me ❤️
You can find it here:
YouTube

Feel free to follow me to get notified when new articles are out ;)

Top comments (0)