Skip to content

Commit

Permalink
Add block.json schema defintion to core blocks
Browse files Browse the repository at this point in the history
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",
  • Loading branch information
mkaz committed Oct 24, 2021
1 parent f4ea8c8 commit d377182
Show file tree
Hide file tree
Showing 78 changed files with 92 additions and 32 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.

## 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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/buttons",
"title": "Buttons",
Expand All @@ -21,7 +22,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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/columns",
"title": "Columns",
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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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": {
"orientation": {
Expand Down Expand Up @@ -81,10 +78,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://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/nextpage",
"title": "Page Break",
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/page-list/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/page-list",
"title": "Page List",
Expand Down Expand Up @@ -37,7 +38,7 @@
"showSubmenuIcon": {
"type": "boolean"
},
"openSubmenusOnClick" : {
"openSubmenusOnClick": {
"type": "boolean"
}
},
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://json.schemastore.org/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://json.schemastore.org/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-author/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/post-comment-author",
"title": "Post Comment Author",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comment-content/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/post-comment-content",
"title": "Post Comment Content",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-comment-date/block.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/post-comment-date",
"title": "Post Comment Date",
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://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/post-comment",
"title": "Post Comment",
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://json.schemastore.org/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://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/post-comments-form",
"title": "Post Comments Form",
Expand All @@ -22,5 +23,9 @@
"lineHeight": true
}
},
"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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/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://json.schemastore.org/block.json",
"apiVersion": 2,
"name": "core/preformatted",
"title": "Preformatted",
Expand Down
Loading

0 comments on commit d377182

Please sign in to comment.