Skip to content

Commit

Permalink
Add schemas package
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mkaz committed Oct 27, 2021
1 parent 522a67c commit bffbe3b
Show file tree
Hide file tree
Showing 6 changed files with 1,616 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/schemas/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
30 changes: 30 additions & 0 deletions packages/schemas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## Unreleased

## 2.2.0 (2021-07-21)

### Enhancement

- Ensure that the warning for a given message is logged only once.

## 2.1.0 (2021-05-20)

## 2.0.0 (2021-05-14)

### Breaking Changes

- 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/.
- 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/.

## 1.4.0 (2021-03-17)

## 1.1.0 (2020-04-15)

### New feature

- Include TypeScript type declarations ([#18942](https://github.com/WordPress/gutenberg/pull/18942))

## 1.0.0 (2020-02-04)

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

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

## Installation

Install the module

```shell
$ npm install @wordpress/schemas --save-dev
```

## 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 bffbe3b

Please sign in to comment.