Skip to content

Commit

Permalink
Add schemas package (#35998)
Browse files Browse the repository at this point in the history
* Add schemas package

Creates a new package to hold the block.json and theme.json files that
can then be synced to the SchemaStore. We want a package within
Gutenberg so we can use the schemas internally to validate package files
such as blocks in the block-library as well as generate documentation.

Closes #35927

* Add schema package doc entry

* Update CHANGELOG.md

* Update packages/schemas/package.json

* Update packages/schemas/package.json

* Remove category from 'required' list

* Move schemas out of packages to top-level

* .npmrc and package.json not needed for non-npm package

* No installation necessary

* Remove package docs

Co-authored-by: Greg Ziółkowski <[email protected]>
  • Loading branch information
mkaz and gziolo committed Nov 1, 2021
1 parent f58c4f8 commit 681619a
Show file tree
Hide file tree
Showing 4 changed files with 1,554 additions and 0 deletions.
5 changes: 5 additions & 0 deletions schemas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## Unreleased

Initial release.
26 changes: 26 additions & 0 deletions schemas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Schemas

The collection of schemas used in WordPress, including the `theme.json` schema, and `block.json` schemas.

## Usage

JSON schemas are used by code editors to offer tooltips, autocomplete, and validation. To use in your JSON file, add the `$schema` property to the top of the file with the value of the schema URL.

For example, in your `block.json` file you would add:

```json
{
"$schema": "https://raw.githubusercontent.com/WordPress/gutenberg/trunk/packages/schemas/json/block.json"
}
```

## SchemaStore.org

[SchemaStore.org](https://schemastore.org) is an open collection of schemas, including the WordPress `theme.json` and `block.json` schemas. Any changes to schemas in this package should be mirror there.

To update on SchemaStore, create a PR at their repository [SchemaStore/schemastore](https://github.com/SchemaStore/schemastore/). The files can be found in their reposiory at:

- block.json: `src/schemas/json/block.json`
- theme.json: `src/schemas/json/theme-v1.json`

<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
Loading

0 comments on commit 681619a

Please sign in to comment.