Skip to content
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

Docs: Add variations key to block.json JSON schema definition #42539

Merged
merged 8 commits into from Jul 20, 2022

Conversation

fabiankaegy
Copy link
Member

@fabiankaegy fabiankaegy commented Jul 19, 2022

What?

Add the variations key with all of its available sub properties to the block.json JSON schema.

Why?

The JSON Schemas are great because they greatly improve the Developer Experience of working with custom blocks. However, they aren't of much use if they are not including all the options that are actually available.

Closes #40490.
Part of #41236.

How?

Testing Instructions

will update this once the initial testing passes

@fabiankaegy fabiankaegy added [Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers Developer Experience Ideas about improving block and theme developer experience labels Jul 19, 2022
@fabiankaegy fabiankaegy self-assigned this Jul 19, 2022
@fabiankaegy fabiankaegy marked this pull request as ready for review July 19, 2022 19:01
schemas/json/block.json Outdated Show resolved Hide resolved
@gziolo gziolo mentioned this pull request Jul 20, 2022
58 tasks
@fabiankaegy
Copy link
Member Author

One question I have for this addition is how we handle the actual versioning of this. Technically this is possible in block.json files since WordPress 5.8. So in theory it would need to get merged into the wp/5.8, wp/5.9, and wp/6.0 branches.

@gziolo
Copy link
Member

gziolo commented Jul 20, 2022

One question I have for this addition is how we handle the actual versioning of this. Technically this is possible in block.json files since WordPress 5.8. So in theory it would need to get merged into the wp/5.8, wp/5.9, and wp/6.0 branches.

Was it WP 5.8 when it got introduced? It would make perfect sense to cherry-pick this commit tho all those branches then 👍🏻

We also miss the section for variations on the Block Metadata reference page:

https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#block-api

It doesn't need to be so detailed as we can always reference another page:
https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-variations.md

The only remark would be that JavaScript functions (isActive) and React elements (icon) can't be used in block.json.

@fabiankaegy
Copy link
Member Author

@gziolo I added Variations to the block metadata documentation and included the callout you've mentioned 👍

@fabiankaegy
Copy link
Member Author

Also @gziolo I just checked in Core and it looks like it was introduced in 5.9 WordPress/wordpress-develop@d9599ad

So we should only cherry-pick it on the wp/5.9 and wp/6.0 branches

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent job documenting block variations with block.json ❤️

I left some nitpicks to polish just before landing this PR. Thank you so much for the initiative!

@gziolo
Copy link
Member

gziolo commented Jul 20, 2022

Also @gziolo I just checked in Core and it looks like it was introduced in 5.9 WordPress/wordpress-develop@d9599ad

So we should only cherry-pick it on the wp/5.9 and wp/6.0 branches

Awesome, good job checking it 👍🏻

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
@gziolo gziolo changed the title add variations key to block.json JSON schema definition Docs: Add variations key to block.json JSON schema definition Jul 20, 2022
@fabiankaegy fabiankaegy merged commit de213ef into trunk Jul 20, 2022
@fabiankaegy fabiankaegy deleted the fix/add-variations-to-block-schema branch July 20, 2022 09:08
@github-actions github-actions bot added this to the Gutenberg 13.8 milestone Jul 20, 2022
fabiankaegy added a commit that referenced this pull request Jul 20, 2022
…2539)

* add variations key to block.json JSON schema definition
* Update docs/reference-guides/block-api/block-metadata.md with information about variations key

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
fabiankaegy added a commit that referenced this pull request Jul 20, 2022
…2539)

* add variations key to block.json JSON schema definition
* Update docs/reference-guides/block-api/block-metadata.md with information about variations key

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
@fabiankaegy
Copy link
Member Author

gziolo added a commit that referenced this pull request Jul 20, 2022
…2539) (#42553)

* add variations key to block.json JSON schema definition
* Update docs/reference-guides/block-api/block-metadata.md with information about variations key

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
gziolo added a commit that referenced this pull request Jul 20, 2022
…2539) (#42552)

* add variations key to block.json JSON schema definition
* Update docs/reference-guides/block-api/block-metadata.md with information about variations key

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
@caraya caraya mentioned this pull request Sep 1, 2022
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience [Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update help docs and schema file with block variations
3 participants