From e3ed4cb66ed47328819a9f28430326adfd4a63e0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 9 Mar 2024 13:24:24 +0000 Subject: [PATCH 1/5] New REST API routes for 6.5. --- composer.json | 2 +- packages/wp-types/readme.md | 9 ++++++++- readme.md | 9 ++++++++- tests/data/rest-api/routes/routes.json | 7 +++++++ .../rest-api/routes/wp-v2-font-collections-slug.json | 3 +++ tests/data/rest-api/routes/wp-v2-font-collections.json | 3 +++ ...wp-v2-font-families-font-family-id-font-faces-id.json | 3 +++ .../wp-v2-font-families-font-family-id-font-faces.json | 3 +++ tests/data/rest-api/routes/wp-v2-font-families-id.json | 3 +++ tests/data/rest-api/routes/wp-v2-font-families.json | 3 +++ .../routes/wp-v2-global-styles-parent-revisions-id.json | 3 +++ 11 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 tests/data/rest-api/routes/wp-v2-font-collections-slug.json create mode 100644 tests/data/rest-api/routes/wp-v2-font-collections.json create mode 100644 tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces-id.json create mode 100644 tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces.json create mode 100644 tests/data/rest-api/routes/wp-v2-font-families-id.json create mode 100644 tests/data/rest-api/routes/wp-v2-font-families.json create mode 100644 tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions-id.json diff --git a/composer.json b/composer.json index 0569ec6..21ac3f3 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "ext-pdo_sqlite": "*", "johnbillion/args": "1.7.0", "roots/wordpress-core-installer": "^1.0.0", - "roots/wordpress-full": "~6.4.0", + "roots/wordpress-full": "dev-main", "wp-cli/core-command": "^2", "wp-cli/db-command": "^2", "wp-cli/language-command": "^2", diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index c5e67a6..2622a45 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -52,8 +52,15 @@ Route | Schema /wp/v2/categories/{id} | `WP_REST_API_Category` /wp/v2/comments | `WP_REST_API_Comments` /wp/v2/comments/{id} | `WP_REST_API_Comment` +/wp/v2/wp/v2/font-collections | Todo +/wp/v2/wp/v2/font-collections/{slug} | Todo +/wp/v2/wp/v2/font-families | Todo +/wp/v2/wp/v2/font-families/{id}/ | Todo +/wp/v2/wp/v2/font-families/{id}/font-faces | Todo +/wp/v2/wp/v2/font-families/{id}/font-faces/{id} | Todo /wp/v2/global-styles/{id} | Todo -/wp/v2/global-styles/{id}/revisions | Todo +/wp/v2/global-styles/{parent}/revisions | Todo +/wp/v2/global-styles/{parent}/revisions/{id} | Todo /wp/v2/global-styles/themes/{stylesheet}/variations | Todo /wp/v2/global-styles/themes/{stylesheet} | Todo /wp/v2/media | `WP_REST_API_Attachments` diff --git a/readme.md b/readme.md index 23adcf2..ec71a33 100644 --- a/readme.md +++ b/readme.md @@ -56,8 +56,15 @@ Route | Schema /wp/v2/categories/{id} | `WP_REST_API_Category` /wp/v2/comments | `WP_REST_API_Comments` /wp/v2/comments/{id} | `WP_REST_API_Comment` +/wp/v2/wp/v2/font-collections | Todo +/wp/v2/wp/v2/font-collections/{slug} | Todo +/wp/v2/wp/v2/font-families | Todo +/wp/v2/wp/v2/font-families/{id}/ | Todo +/wp/v2/wp/v2/font-families/{id}/font-faces | Todo +/wp/v2/wp/v2/font-families/{id}/font-faces/{id} | Todo /wp/v2/global-styles/{id} | Todo -/wp/v2/global-styles/{id}/revisions | Todo +/wp/v2/global-styles/{parent}/revisions | Todo +/wp/v2/global-styles/{parent}/revisions/{id} | Todo /wp/v2/global-styles/themes/{stylesheet}/variations | Todo /wp/v2/global-styles/themes/{stylesheet} | Todo /wp/v2/media | `WP_REST_API_Attachments` diff --git a/tests/data/rest-api/routes/routes.json b/tests/data/rest-api/routes/routes.json index df19d17..30e6705 100644 --- a/tests/data/rest-api/routes/routes.json +++ b/tests/data/rest-api/routes/routes.json @@ -17,8 +17,15 @@ "/wp/v2/categories/(?P[\\d]+)", "/wp/v2/comments", "/wp/v2/comments/(?P[\\d]+)", + "/wp/v2/font-collections", + "/wp/v2/font-collections/(?P[\\/\\w-]+)", + "/wp/v2/font-families", + "/wp/v2/font-families/(?P[\\d]+)/font-faces", + "/wp/v2/font-families/(?P[\\d]+)/font-faces/(?P[\\d]+)", + "/wp/v2/font-families/(?P[\\d]+)", "/wp/v2/global-styles/(?P[\\/\\w-]+)", "/wp/v2/global-styles/(?P[\\d]+)/revisions", + "/wp/v2/global-styles/(?P[\\d]+)/revisions/(?P[\\d]+)", "/wp/v2/global-styles/themes/(?P[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)/variations", "/wp/v2/global-styles/themes/(?P[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)", "/wp/v2/media", diff --git a/tests/data/rest-api/routes/wp-v2-font-collections-slug.json b/tests/data/rest-api/routes/wp-v2-font-collections-slug.json new file mode 100644 index 0000000..fe342a0 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-font-collections-slug.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/font-collections/(?P[\\/\\w-]+)" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-font-collections.json b/tests/data/rest-api/routes/wp-v2-font-collections.json new file mode 100644 index 0000000..b7973c4 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-font-collections.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/font-collections" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces-id.json b/tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces-id.json new file mode 100644 index 0000000..c1b1c68 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces-id.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/font-families/(?P[\\d]+)/font-faces/(?P[\\d]+)" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces.json b/tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces.json new file mode 100644 index 0000000..c083df8 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-font-families-font-family-id-font-faces.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/font-families/(?P[\\d]+)/font-faces" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-font-families-id.json b/tests/data/rest-api/routes/wp-v2-font-families-id.json new file mode 100644 index 0000000..f0add66 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-font-families-id.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/font-families/(?P[\\d]+)" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-font-families.json b/tests/data/rest-api/routes/wp-v2-font-families.json new file mode 100644 index 0000000..d8e3e7d --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-font-families.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/font-families" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions-id.json new file mode 100644 index 0000000..534f1e8 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions-id.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/global-styles/(?P[\\d]+)/revisions/(?P[\\d]+)" +} \ No newline at end of file From e65bc19c5820dfbdc68047d7705e7e63cc576da2 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 9 Mar 2024 13:24:42 +0000 Subject: [PATCH 2/5] Docs. --- packages/wp-types/readme.md | 6 +++--- readme.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 2622a45..1d54a02 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -8,7 +8,7 @@ This package provides well-documented TypeScript definitions that describe the s * WordPress REST API responses such as from `/wp/v2/posts` and `/wp/v2/users` * Various property types and allowed values of both -The definitions were last updated for WordPress 6.4. +The definitions were last updated for WordPress 6.5. ## What's included? @@ -181,12 +181,12 @@ npm install wp-types --save-dev This package is versioned so that you can specify both the schema version and the WordPress branch version in a way that's compatible with semantic versioning. Given version `x.y.z`: * The major version number (`x`) indicates the schema version number, currently `3` -* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `64` for WordPress 6.4 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `65` for WordPress 6.5 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.64.0` - Schema version 3 for WordPress 6.4 +* `~3.65.0` - Schema version 3 for WordPress 6.5 * `~3.60.0` - Schema version 3 for WordPress 6.0 * `~3.57.0` - Schema version 3 for WordPress 5.7 * `^3.0.0` - Schema version 3 for the latest WordPress version diff --git a/readme.md b/readme.md index ec71a33..2bdd24b 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,7 @@ This package provides well-documented JSON schemas that describe the shape of: The schemas in this library are used to generate [the WordPress TypeScript definitions provided by the `wp-types` package](https://www.npmjs.com/package/wp-types). -The schemas were last updated for WordPress 6.4. +The schemas were last updated for WordPress 6.5. ## What's included? @@ -186,12 +186,12 @@ npm install wp-json-schemas This package is versioned so that you can specify both the schema version and the WordPress branch version in a way that's compatible with semantic versioning. Given version `x.y.z`: * The major version number (`x`) indicates the schema version number, currently `3` -* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `64` for WordPress 6.4 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `65` for WordPress 6.5 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.64.0` - Schema version 3 for WordPress 6.4 +* `~3.65.0` - Schema version 3 for WordPress 6.5 * `~3.60.0` - Schema version 3 for WordPress 6.0 * `~3.57.0` - Schema version 3 for WordPress 5.7 * `^3.0.0` - Schema version 3 for the latest WordPress version From 354aa5f878a80e1b8d7851b19c679e036f4f29f6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 9 Mar 2024 13:38:16 +0000 Subject: [PATCH 3/5] New properties and REST fields for 6.5. --- packages/wp-types/index.ts | 32 ++++++++++++++++++++++++++ schemas/block-type.json | 39 ++++++++++++++++++++++++++++++++ schemas/rest-api/attachment.json | 5 ++++ schemas/rest-api/block-type.json | 27 ++++++++++++++++++++++ 4 files changed, 103 insertions(+) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index d974d84..1cdb9a0 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -308,6 +308,22 @@ export interface WP_Block_Type { | { [k: string]: string; }; + /** + * Allowed child block types. + */ + allowed_blocks: string[] | null; + /** + * Block variations callback. + */ + variation_callback: Callable | null; + /** + * Block type front end only script module IDs. + */ + view_script_module_ids: string[]; + /** + * Block type front end only style handles. + */ + view_style_handles: string[]; /** * Custom CSS selectors for theme.json style generation. */ @@ -2098,6 +2114,10 @@ export interface WP_REST_API_Attachment { * Unique identifier for the attachment. */ id: number; + /** + * The ID of the featured media for the post. + */ + featured_media: number; /** * URL to the attachment. */ @@ -2631,6 +2651,18 @@ export interface WP_REST_API_Block_Type { | { [k: string]: string; }; + /** + * Allowed child block types. + */ + allowed_blocks: string[] | null; + /** + * Block type front end only script module IDs. + */ + view_script_module_ids: string[]; + /** + * Block type front end only style handles. + */ + view_style_handles: string[]; /** * Public text domain. */ diff --git a/schemas/block-type.json b/schemas/block-type.json index 7366a15..803c666 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -22,6 +22,10 @@ "attributes", "uses_context", "block_hooks", + "allowed_blocks", + "variation_callback", + "view_script_module_ids", + "view_style_handles", "provides_context", "editor_script_handles", "script_handles", @@ -116,6 +120,41 @@ } ] }, + "allowed_blocks": { + "description": "Allowed child block types.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "variation_callback": { + "description": "Block variations callback.", + "anyOf": [ + { + "$ref": "properties/callable.json" + }, + { + "type": "null" + } + ] + }, + "view_script_module_ids": { + "description": "Block type front end only script module IDs.", + "type": "array", + "items": { + "type": "string" + } + }, + "view_style_handles": { + "description": "Block type front end only style handles.", + "type": "array", + "items": { + "type": "string" + } + }, "selectors": { "description": "Custom CSS selectors for theme.json style generation.", "oneOf": [ diff --git a/schemas/rest-api/attachment.json b/schemas/rest-api/attachment.json index 57306ad..14f5746 100644 --- a/schemas/rest-api/attachment.json +++ b/schemas/rest-api/attachment.json @@ -9,6 +9,7 @@ "date_gmt", "guid", "id", + "featured_media", "link", "modified", "modified_gmt", @@ -74,6 +75,10 @@ "description": "Unique identifier for the attachment.", "type": "integer" }, + "featured_media": { + "description": "The ID of the featured media for the post.", + "type": "integer" + }, "link": { "readOnly": true, "description": "URL to the attachment.", diff --git a/schemas/rest-api/block-type.json b/schemas/rest-api/block-type.json index 8433730..0f68b89 100644 --- a/schemas/rest-api/block-type.json +++ b/schemas/rest-api/block-type.json @@ -25,6 +25,9 @@ "styles", "variations", "block_hooks", + "allowed_blocks", + "view_script_module_ids", + "view_style_handles", "textdomain", "parent", "keywords", @@ -262,6 +265,30 @@ } ] }, + "allowed_blocks": { + "description": "Allowed child block types.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "view_script_module_ids": { + "description": "Block type front end only script module IDs.", + "type": "array", + "items": { + "type": "string" + } + }, + "view_style_handles": { + "description": "Block type front end only style handles.", + "type": "array", + "items": { + "type": "string" + } + }, "textdomain": { "description": "Public text domain.", "type": [ From a481d6052e3cc32b879ea875a74fb5b724edfd68 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 2 Apr 2024 22:39:56 +0200 Subject: [PATCH 4/5] Switch to 6.5 stable. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 21ac3f3..aba8c77 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "ext-pdo_sqlite": "*", "johnbillion/args": "1.7.0", "roots/wordpress-core-installer": "^1.0.0", - "roots/wordpress-full": "dev-main", + "roots/wordpress-full": "~6.5.0", "wp-cli/core-command": "^2", "wp-cli/db-command": "^2", "wp-cli/language-command": "^2", From 022141d1cf5e9e54c8cacc3b936ad91c4796bb62 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 2 Apr 2024 23:07:04 +0200 Subject: [PATCH 5/5] This property is no longer public. --- packages/wp-types/index.ts | 4 ---- schemas/block-type.json | 8 -------- 2 files changed, 12 deletions(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 1cdb9a0..2519a27 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -360,10 +360,6 @@ export interface WP_Block_Type { [k: string]: unknown; } | null; - /** - * Context values inherited by blocks of this type. - */ - uses_context: string[]; /** * Context provided by blocks of this type. */ diff --git a/schemas/block-type.json b/schemas/block-type.json index 803c666..0c87544 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -20,7 +20,6 @@ "example", "render_callback", "attributes", - "uses_context", "block_hooks", "allowed_blocks", "variation_callback", @@ -216,13 +215,6 @@ } ] }, - "uses_context": { - "description": "Context values inherited by blocks of this type.", - "type": "array", - "items": { - "type": "string" - } - }, "provides_context": { "description": "Context provided by blocks of this type.", "oneOf": [