-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON Schema for WordPress block.json
files
#1879
Add JSON Schema for WordPress block.json
files
#1879
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! I'm very happy that other folks are taking this schema thing and running with it for WordPress. 🙂
I noted a few of my personal opinions about styling for schemas. A lot of my inspiration for theme-v1.json came from the tsconfig.json schema since that was a popular project that I was familiar with. If we have a better way to do thing, we should do it the better way—I'm not very strongly opinionated on the things that I mentioned.
The one thing that I do think needs to be changed before merging is removing __experimentalDuotone
. More notes about that in the inline comment.
…t` `items` / `properties`
@ajlende Thank you so much for your thorough review. I have taken your feedback and fixed the different suggestions. I wasn't able to cut down all the |
block.json
schemablock.json
schema
block.json
schemablock.json
files
I love it! Thanks for your work on this! ❤️ |
Let me know when ready to merge |
@madskristensen We are :) |
For this error, we may want to either note that it's deprecated in the That being said, the |
I just removed the @madskristensen So it is ready to be merged :) |
Thanks |
Updates documentation recommending to use schema validation. A block.json JSON schema was added to the SchemaStore that allows for editors to provide additional tooltip, autocomplete, and some validation when working with a block.json file. Added in: SchemaStore/schemastore#1879
Updates documentation recommending to use schema validation. A block.json JSON schema was added to the SchemaStore that allows for editors to provide additional tooltip, autocomplete, and some validation when working with a block.json file. Added in: SchemaStore/schemastore#1879
"items": { | ||
"type": "string", | ||
"enum": [ | ||
"vertical" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, according to the PR that introduced support for this in Gutenberg, there are a couple of options to declare support for padding
at https://github.com/WordPress/gutenberg/pull/33859/files#diff-cb2052b95e3c5b5fa711f6519d1e3c376597cd1747e6a0a781dc51447255ef16R588
- boolean
- individual properties: an array that can contain any of
top
,left
,bottom
,right
- axial properties: an array that can contain any of
vertical
,horizontal
From what I've gathered in this PR I presume that we don't need two items, one for vertical
here and the other for horizontal
below, but, instead, we need to declare the enum like [ 'vertical', 'horizontal' ]
. Does that make sense? It seems this is creating issues, see WordPress/gutenberg#35902 (comment)
Same for the margin
declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 #1903
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. I misread the following line
A spacing property may support arbitrary individual sides or axial sides, but not a mix of both.
from the handbook to mean that it can only have either or of the axial controls but rereading it that was incorrect.
This PR adds a JSON Schema for the
block.json
file used in WordPress development to define metadata for blocks for the editor.The reference this schema is based on can be found here: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/
Closes #1878