Skip to content

Commit

Permalink
Add block.json schema defintion to core blocks (#35900)
Browse files Browse the repository at this point in the history
* Add block.json schema defintion to core blocks

Adds the schema defintion to the top of each core block to help
development, in supported editors the schema definition will show
validation errors, offer tooltips and autocomplete.

Schema definition:

	"$schema": "https://json.schemastore.org/block.json",

* Update packages/block-library/CHANGELOG.md

* Switch URL to wp.org with redirect

Co-authored-by: Greg Ziółkowski <[email protected]>
  • Loading branch information
mkaz and gziolo committed Nov 9, 2021
1 parent db67d94 commit bc78b2c
Show file tree
Hide file tree
Showing 78 changed files with 92 additions and 33 deletions.
2 changes: 2 additions & 0 deletions packages/block-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Code quality: Add block schema to each core block ([#35900](https://github.com/WordPress/gutenberg/pull/35900)).

## 6.0.0 (2021-09-09)

### Breaking Change
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/archives/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/archives",
"title": "Archives",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/audio/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/audio",
"title": "Audio",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/block/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/block",
"title": "Reusable block",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/button/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/button",
"title": "Button",
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/buttons/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/buttons",
"title": "Buttons",
Expand All @@ -12,7 +13,7 @@
"__experimentalExposeControlsToChildren": true,
"spacing": {
"blockGap": true,
"margin": ["top", "bottom" ],
"margin": [ "top", "bottom" ],
"__experimentalDefaultControls": {
"blockGap": true
}
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/calendar/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/calendar",
"title": "Calendar",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/categories/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/categories",
"title": "Categories",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/code/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/code",
"title": "Code",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/column/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/column",
"title": "Column",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/columns/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/columns",
"title": "Columns",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-author-name/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/comment-author-name",
"title": "Comment Author Name",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-content/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/comment-content",
"title": "Comment Content",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/comment-date/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/comment-date",
"title": "Comment Date",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/cover",
"title": "Cover",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/embed/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/embed",
"title": "Embed",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/file/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/file",
"title": "File",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/freeform/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/freeform",
"title": "Classic",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/gallery/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/gallery",
"title": "Gallery",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/group/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/group",
"title": "Group",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/heading/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/heading",
"title": "Heading",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/home-link/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/home-link",
"category": "design",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/html/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/html",
"title": "Custom HTML",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/image/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/image",
"title": "Image",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/latest-comments/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/latest-comments",
"title": "Latest Comments",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/latest-posts/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/latest-posts",
"title": "Latest Posts",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/list/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/list",
"title": "List",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/loginout/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/loginout",
"title": "Login/out",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/media-text/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/media-text",
"title": "Media & Text",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/missing/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/missing",
"title": "Unsupported",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/more/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/more",
"title": "More",
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/navigation-link/block.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/navigation-link",
"title": "Custom Link",
"category": "design",
"parent": [
"core/navigation"
],
"parent": [ "core/navigation" ],
"description": "Add a page, link, or another item to your navigation.",
"textdomain": "default",
"attributes": {
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/navigation-submenu/block.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/navigation-submenu",
"title": "Submenu",
"category": "design",
"parent": [
"core/navigation"
],
"parent": [ "core/navigation" ],
"description": "Add a submenu to your navigation.",
"textdomain": "default",
"attributes": {
Expand Down
20 changes: 4 additions & 16 deletions packages/block-library/src/navigation/block.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/navigation",
"title": "Navigation",
"category": "theme",
"description": "A collection of blocks that allow visitors to get around your site.",
"keywords": [
"menu",
"navigation",
"links"
],
"keywords": [ "menu", "navigation", "links" ],
"textdomain": "default",
"attributes": {
"navigationMenuId": {
Expand Down Expand Up @@ -78,10 +75,7 @@
"orientation": "orientation"
},
"supports": {
"align": [
"wide",
"full"
],
"align": [ "wide", "full" ],
"anchor": true,
"html": false,
"inserter": true,
Expand All @@ -99,13 +93,7 @@
},
"spacing": {
"blockGap": true,
"units": [
"px",
"em",
"rem",
"vh",
"vw"
],
"units": [ "px", "em", "rem", "vh", "vw" ],
"__experimentalDefaultControls": {
"blockGap": true
}
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/nextpage/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/nextpage",
"title": "Page Break",
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/page-list/block.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/page-list",
"title": "Page List",
"category": "widgets",
"description": "Display a list of all pages.",
"keywords": [ "menu", "navigation" ],
"textdomain": "default",
"attributes": {
},
"attributes": {},
"usesContext": [
"textColor",
"customTextColor",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/paragraph/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/paragraph",
"title": "Paragraph",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-author/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-author",
"title": "Post Author",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comment/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-comment",
"title": "Post Comment (deprecated)",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comments-count/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-comments-count",
"title": "Post Comments Count",
Expand Down
7 changes: 6 additions & 1 deletion packages/block-library/src/post-comments-form/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-comments-form",
"title": "Post Comments Form",
Expand Down Expand Up @@ -29,5 +30,9 @@
}
}
},
"style": [ "wp-block-post-comments-form", "wp-block-buttons", "wp-block-button" ]
"style": [
"wp-block-post-comments-form",
"wp-block-buttons",
"wp-block-button"
]
}
1 change: 1 addition & 0 deletions packages/block-library/src/post-comments-link/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-comments-link",
"title": "Post Comments Link",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comments/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-comments",
"title": "Post Comments",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-content/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-content",
"title": "Post Content",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-date/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-date",
"title": "Post Date",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-excerpt/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-excerpt",
"title": "Post Excerpt",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-featured-image/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-featured-image",
"title": "Post Featured Image",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-navigation-link/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-navigation-link",
"title": "Post Navigation Link",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-template/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-template",
"title": "Post Template",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-terms/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-terms",
"title": "Post Terms",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-title",
"title": "Post Title",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/preformatted/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/preformatted",
"title": "Preformatted",
Expand Down
Loading

0 comments on commit bc78b2c

Please sign in to comment.