Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 2 months ago

#60255 closed defect (bug) (fixed)

Add $schema property to block and theme JSON files

Reported by: jonsurrell's profile jonsurrell Owned by: jonsurrell's profile jonsurrell
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests commit add-to-field-guide
Focuses: Cc:

Description

Add $schema to block.json and theme.json files to leverage JSON schema support.

Schemas help ensure that these files conform to expectations. They can help provide autocomplete and documentation if editors are configured to do so.

We provide and maintain these schemas, we should be using them. This can help to ensure that our own declarations are correct and that the schemas are also correct.

See https://github.com/WordPress/gutenberg/pull/57201

Change History (12)

This ticket was mentioned in PR #5868 on WordPress/wordpress-develop by @jonsurrell.


3 months ago
#1

  • Keywords has-patch has-unit-tests added

Add $schema to block.json and theme.json files.

This is a port of https://github.com/WordPress/gutenberg/pull/57201

Trac ticket: https://core.trac.wordpress.org/ticket/60255

Add $schema to block.json and theme.json files to leverage JSON schema support.

Schemas help ensure that these files conform to expectations. They can help provide autocomplete and documentation if editors are configured to do so.

We provide and maintain these schemas, we should be using them. This can help to ensure that our own declarations are correct and that the schemas are also correct.

@gziolo commented on PR #5868:


3 months ago
#2

https://github.com/WordPress/wordpress-develop/actions/runs/7529540433/job/20493970875?pr=5868

Files in src/wp-includes/blocks are synced from npm packages so they will get updated next time WordPress packages get updated.

@jonsurrell commented on PR #5868:


3 months ago
#3

Good to know, thanks! I reverted the changes to src/wp-includes/blocks.

@dmsnell commented on PR #5868:


3 months ago
#4

@sirreal it looks like some of these should come over through the normal package update process? do you know if this is true?

@jonsurrell commented on PR #5868:


3 months ago
#5

src/wp-includes/blocks changes should be updated automatically (https://github.com/WordPress/wordpress-develop/pull/5868#issuecomment-1892189866) - I had changed those files but reverted the changes.

#6 @Bernhard Reiter
3 months ago

  • Keywords commit added

@Bernhard Reiter commented on PR #5868:


3 months ago
#7

I've taken the liberty of slightly tweaking the test hooked blocks' names in https://github.com/WordPress/wordpress-develop/pull/5868/commits/126b31bf0dc64ae3f8a017bb015346f92ea9a739. Hope that's okay! 😊

@jonsurrell commented on PR #5868:


3 months ago
#8

Looks good, thanks @ockham.

#9 @Bernhard Reiter
3 months ago

  • Milestone changed from Awaiting Review to 6.5

#10 @Bernhard Reiter
3 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 57336:

General: Add $schema property to block and theme JSON files.

Additionally, this changeset fixes some of the block.json and theme.json files in PHPUnit tests by adding missing title properties to satisfy the schema. Those changes have no impact on the runtime whatsoever and do not change the result of unit tests.

Note that some block and theme JSON files still aren't valid according to the schema. Fixing is underway; the required changes will be merged subsequently.

Props jonsurrell, dmsnell, gziolo.
Fixes #60255.

#12 @stevenlinx
2 months ago

  • Keywords add-to-field-guide added
Note: See TracTickets for help on using tickets.