Description
openedon Oct 25, 2021
What problem does this address?
Recently schema definitions for theme.json and block.json were uploaded to the SchemaStore.org (theme.json, and block.json).
Using JSON schemas makes it easier for development. Supported editors can show tooltips, autocomplete, and validation issues. Documenation on using schemas were added in: #35835 #35739
The SchemaStore.org is a global open collection of JSON schemas, plus includes good documentation on using schemas. So it is still worthwhile to list our schemas there, as developers may look there to use them as it gets popular.
@gziolo brought up in #35902 (comment) and #35843 (comment) that we should have a definitive source in the Gutenberg repo, which could also be used for validation during the build processs.
What is your proposed solution?
We should create a "schemas" package at "@wordpress/schemas" to hold the definitive schemas definitions, these can by copied to the SchemaStore to keep in-sync. Another benefit of having the schemas in the Gutenberg repo is they would also get versioned with tags/branches related to the releases, for example the WP 5.8 could be:
https://github.com/WordPress/gutenberg/tree/wp/5.8/packages/schemas/block.json
Questions
The schema store has three directories, js
, ,css
, and json
and the schemas are nested there.
@gziolo mentions in #35902 (comment) that there are i18n configs that could find a home in the schemas package.
So what directory structure should we use in the package?
My suggestion for flexibility to create: a json/
directory to start and store them there.