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

[Documentation]: Add link for more details about block variations' example #50909

Merged
merged 1 commit into from
May 24, 2023

Conversation

ntsekouras
Copy link
Contributor

What?

In block variation docs the example is not documented properly. This PR adds a link with more info about it.

@ntsekouras ntsekouras force-pushed the docs/add-link-block-variarions-example branch from 4c73f2f to d5e3a1a Compare May 24, 2023 12:52
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ntsekouras ntsekouras merged commit 4601bec into trunk May 24, 2023
@ntsekouras ntsekouras deleted the docs/add-link-block-variarions-example branch May 24, 2023 14:01
@github-actions github-actions bot added this to the Gutenberg 15.9 milestone May 24, 2023
@mcsf
Copy link
Contributor

mcsf commented May 25, 2023

Would it be useful to copy the portion of the block.json schema concerning /example over to /variations/example?

Additionally, should we / how could we better surface our schemas in our docs?

@ntsekouras
Copy link
Contributor Author

Would it be useful to copy the portion of the block.json schema concerning /example over to /variations/example?

I think it's not necessary, because it's the same block API and we would have to maintain the docs in two places. No strong opinions though..

Regarding the surfacing of schemas, I've no good thoughts right now :)

@mcsf
Copy link
Contributor

mcsf commented May 25, 2023

Alternatively, we could use $ref:

diff --git a/schemas/json/block.json b/schemas/json/block.json
index 5b92a654fb..49aed81e97 100644
--- a/schemas/json/block.json
+++ b/schemas/json/block.json
@@ -706,8 +706,7 @@
 						"description": "Initial configuration of nested blocks."
 					},
 					"example": {
-						"type": "object",
-						"description": "Example provides structured data for the block preview. You can set to undefined to disable the preview shown for the block type."
+						"$ref": "#/properties/example"
 					},
 					"scope": {
 						"type": "array",

Proof of concept:

json-schema-1.0.0.tgz — run w/ npm i && npm test — requires node@18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants