Skip to content

Commit bffbe3b

Browse files
committed
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
1 parent 522a67c commit bffbe3b

File tree

6 files changed

+1616
-0
lines changed

6 files changed

+1616
-0
lines changed

packages/schemas/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

packages/schemas/CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
2+
3+
## Unreleased
4+
5+
## 2.2.0 (2021-07-21)
6+
7+
### Enhancement
8+
9+
- Ensure that the warning for a given message is logged only once.
10+
11+
## 2.1.0 (2021-05-20)
12+
13+
## 2.0.0 (2021-05-14)
14+
15+
### Breaking Changes
16+
17+
- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/.
18+
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at https://nodejs.org/en/about/releases/.
19+
20+
## 1.4.0 (2021-03-17)
21+
22+
## 1.1.0 (2020-04-15)
23+
24+
### New feature
25+
26+
- Include TypeScript type declarations ([#18942](https://github.com/WordPress/gutenberg/pull/18942))
27+
28+
## 1.0.0 (2020-02-04)
29+
30+
Initial release.

packages/schemas/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Schemas
2+
3+
The collection of schemas used in WordPress, including the `theme.json` schema, and `block.json` schemas.
4+
5+
## Installation
6+
7+
Install the module
8+
9+
```shell
10+
$ npm install @wordpress/schemas --save-dev
11+
```
12+
13+
## Usage
14+
15+
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.
16+
17+
For example, in your `block.json` file you would add:
18+
19+
```json
20+
{
21+
"$schema": "https://raw.githubusercontent.com/WordPress/gutenberg/trunk/packages/schemas/json/block.json"
22+
}
23+
```
24+
25+
## SchemaStore.org
26+
27+
[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.
28+
29+
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:
30+
31+
- block.json: `src/schemas/json/block.json`
32+
- theme.json: `src/schemas/json/theme-v1.json`
33+
34+
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>

0 commit comments

Comments
 (0)