[wp-trac] [WordPress Trac] #50615: Editor: Create standalone JSON schema for block type definition

WordPress Trac noreply at wordpress.org
Wed Jul 8 16:36:17 UTC 2020


#50615: Editor: Create standalone JSON schema for block type definition
-----------------------------+------------------------------
 Reporter:  gziolo           |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Editor           |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  rest-api
-----------------------------+------------------------------
Description changed by gziolo:

Old description:

> There is an existing schema for block type definition embedded in the new
> REST API endpoint:
>
> https://github.com/WordPress/wordpress-
> develop/blob/c3993eb19dee52dfd6ca9f9ef7cec785538e361d/src/wp-includes
> /rest-api/endpoints/class-wp-rest-block-types-controller.php#L363-L569
>
> There is also another schema being developed for Block Directory that
> will take part in `block.json` file validation:
>
> https://github.com/tellyworth/plugin-
> directory/blob/25388b9c12193194a16db5264ed84f2f3965552e/block-json/class-
> validator.php#L36-L182
>
> It would be great to consolidate efforts and make such schema publicly
> accessible as it would benefit other projects in the WordPress ecosystem
> like WP-CLI. There is a related discussion related to translatable
> strings extraction, see https://github.com/wp-cli/i18n-
> command/pull/210#issuecomment-634107470
>
> > This kind of schema would need to live somewhere outside of WordPress
> context, where WP-CLI and other tools can easily assess which fields in
> `block.json` are translatable and which aren't.

New description:

 There is an existing schema for block type definition embedded in the new
 REST API endpoint:

 https://github.com/WordPress/wordpress-
 develop/blob/c3993eb19dee52dfd6ca9f9ef7cec785538e361d/src/wp-includes
 /rest-api/endpoints/class-wp-rest-block-types-controller.php#L363-L569

 There is also another schema being developed for Block Directory that will
 take part in `block.json` file validation:

 https://github.com/tellyworth/plugin-
 directory/blob/25388b9c12193194a16db5264ed84f2f3965552e/block-json/class-
 validator.php#L36-L182

 It would be great to consolidate efforts and make such schema publicly
 accessible as it would benefit other projects in the WordPress ecosystem
 like WP-CLI. There is a related discussion related to translatable strings
 extraction, see https://github.com/wp-cli/i18n-
 command/pull/210#issuecomment-634107470

 > This kind of schema would need to live somewhere outside of WordPress
 context, where WP-CLI and other tools can easily assess which fields in
 `block.json` are translatable and which aren't.

 All that would make it also possible to easily extend the schema in one
 place and related tools consuming it could automatically adjust their
 behavior based on the changes applied.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50615#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list