From 5efe6f04d7f9d125c6a453912e3b5187c6d7a461 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 5 Apr 2023 23:27:37 +0100 Subject: [PATCH 01/62] Delete FUNDING.yml --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index b8a2542..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: johnbillion From dcf7dc41197a6872bd5b14b41ba61b19baaea4a4 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 9 Apr 2023 17:08:08 +0100 Subject: [PATCH 02/62] Remove the misleading `$schema` property from the PHP object definitions. --- packages/wp-types/index.ts | 68 -------------------------------- schemas/block-type.json | 4 -- schemas/block.json | 4 -- schemas/comment.json | 4 -- schemas/error-with-error.json | 4 -- schemas/error-without-error.json | 4 -- schemas/error.json | 4 -- schemas/locale.json | 4 -- schemas/network.json | 4 -- schemas/post-type.json | 4 -- schemas/post.json | 4 -- schemas/query.json | 4 -- schemas/rest-api/term.json | 4 -- schemas/role.json | 4 -- schemas/site.json | 4 -- schemas/taxonomy.json | 4 -- schemas/term.json | 4 -- schemas/user.json | 4 -- tests/mu-plugins/mu-plugin.php | 11 ------ 19 files changed, 147 deletions(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index e25e57d..1b5fbe6 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -168,10 +168,6 @@ export interface WP { * Class representing a parsed instance of a block. */ export interface WP_Block { - /** - * JSON schema definition. - */ - $schema?: string; /** * Original parsed array representation of block. */ @@ -241,10 +237,6 @@ export interface WP_Block_Parsed { * Core class representing a block type. */ export interface WP_Block_Type { - /** - * JSON schema definition. - */ - $schema?: string; /** * Block API version. */ @@ -378,10 +370,6 @@ export interface EmptyObject {} * Core class used to organize comments as instantiated objects with defined members. */ export interface WP_Comment { - /** - * JSON schema definition. - */ - $schema?: string; /** * Comment ID. * @@ -459,10 +447,6 @@ export interface WP_Comment { * Container for checking for WordPress errors and error messages. Many core WordPress functions pass this class in the event of an error. */ export interface WP_Error { - /** - * JSON schema definition. - */ - $schema?: string; /** * Stores the list of errors. */ @@ -486,10 +470,6 @@ export interface WP_Error_Messages { * Represents a WP_Error object that contains at least one error. */ export interface WP_Error_With_Error { - /** - * JSON schema definition. - */ - $schema?: string; /** * Stores the list of errors. */ @@ -505,10 +485,6 @@ export interface WP_Error_With_Error { * Represents a WP_Error object that contains no errors. */ export interface WP_Error_Without_Error { - /** - * JSON schema definition. - */ - $schema?: string; /** * Stores the list of errors. */ @@ -522,10 +498,6 @@ export interface WP_Error_Without_Error { * Core class used to store translated data for a locale. */ export interface WP_Locale { - /** - * JSON schema definition. - */ - $schema?: string; /** * Stores the translated strings for the full weekday names. */ @@ -593,10 +565,6 @@ export interface WP_Locale { * Core class used for interacting with a multisite network. */ export interface WP_Network { - /** - * JSON schema definition. - */ - $schema?: string; /** * Domain of the network. */ @@ -620,10 +588,6 @@ export interface WP_Network { * Core class used to implement the WP_Post object. */ export interface WP_Post { - /** - * JSON schema definition. - */ - $schema?: string; /** * Post ID. */ @@ -729,10 +693,6 @@ export interface WP_Post { * Core class used for interacting with post types. */ export interface WP_Post_Type { - /** - * JSON schema definition. - */ - $schema?: string; /** * Post type key. */ @@ -963,10 +923,6 @@ export interface WP_Post_Type_Rewrite { * The WordPress Query class. */ export interface WP_Query { - /** - * JSON schema definition. - */ - $schema?: string; /** * Query vars set by the user. */ @@ -1188,10 +1144,6 @@ export interface WP_Query { * Core class used to implement the WP_Term object. */ export interface WP_Term { - /** - * JSON schema definition. - */ - $schema?: string; /** * Term ID. */ @@ -1261,10 +1213,6 @@ export interface WP_Term { * Core class used to implement the WP_User object. */ export interface WP_User { - /** - * JSON schema definition. - */ - $schema?: string; /** * The user's ID. */ @@ -1363,10 +1311,6 @@ export interface WP_User_Data { * Core class used to extend the user roles API. */ export interface WP_Role { - /** - * JSON schema definition. - */ - $schema?: string; /** * Role name. */ @@ -1380,10 +1324,6 @@ export interface WP_Role { * Core class used for interacting with a multisite site. */ export interface WP_Site { - /** - * JSON schema definition. - */ - $schema?: string; /** * Site ID. * @@ -1455,10 +1395,6 @@ export interface WP_Site { * Core class used for interacting with taxonomies. */ export interface WP_Taxonomy { - /** - * JSON schema definition. - */ - $schema?: string; /** * Taxonomy key. */ @@ -2645,10 +2581,6 @@ export interface WP_REST_API_Statuses { * A taxonomy term object in a REST API context. */ export interface WP_REST_API_Term { - /** - * JSON schema definition. - */ - $schema?: string; /** * Unique identifier for the term. */ diff --git a/schemas/block-type.json b/schemas/block-type.json index 1538218..a615390 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -29,10 +29,6 @@ "style_handles" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "api_version": { "description": "Block API version.", "type": "integer" diff --git a/schemas/block.json b/schemas/block.json index aca3ac7..6f4f1ae 100644 --- a/schemas/block.json +++ b/schemas/block.json @@ -15,10 +15,6 @@ "inner_content" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "parsed_block": { "description": "Original parsed array representation of block.", "allOf": [ diff --git a/schemas/comment.json b/schemas/comment.json index 44a46df..86eb074 100644 --- a/schemas/comment.json +++ b/schemas/comment.json @@ -22,10 +22,6 @@ "user_id" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "comment_ID": { "readOnly": true, "description": "Comment ID.\n\nA numeric string, for compatibility reasons.", diff --git a/schemas/error-with-error.json b/schemas/error-with-error.json index 3b2ce0d..394f074 100644 --- a/schemas/error-with-error.json +++ b/schemas/error-with-error.json @@ -10,10 +10,6 @@ "errors" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "errors": { "description": "Stores the list of errors.", "anyOf": [ diff --git a/schemas/error-without-error.json b/schemas/error-without-error.json index d275433..bde5d6b 100644 --- a/schemas/error-without-error.json +++ b/schemas/error-without-error.json @@ -10,10 +10,6 @@ "errors" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "errors": { "description": "Stores the list of errors.", "anyOf": [ diff --git a/schemas/error.json b/schemas/error.json index d16c7a1..608c8af 100644 --- a/schemas/error.json +++ b/schemas/error.json @@ -10,10 +10,6 @@ "errors" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "errors": { "description": "Stores the list of errors.", "anyOf": [ diff --git a/schemas/locale.json b/schemas/locale.json index de2b5f1..541b972 100644 --- a/schemas/locale.json +++ b/schemas/locale.json @@ -18,10 +18,6 @@ "word_count_type" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "weekday": { "description": "Stores the translated strings for the full weekday names.", "type": "array", diff --git a/schemas/network.json b/schemas/network.json index 7597e09..d8f3d9a 100644 --- a/schemas/network.json +++ b/schemas/network.json @@ -11,10 +11,6 @@ "site_name" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "domain": { "description": "Domain of the network.", "type": "string", diff --git a/schemas/post-type.json b/schemas/post-type.json index e69e4e6..5e5334b 100644 --- a/schemas/post-type.json +++ b/schemas/post-type.json @@ -41,10 +41,6 @@ "rest_controller" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "name": { "description": "Post type key.", "anyOf": [ diff --git a/schemas/post.json b/schemas/post.json index 964a05e..9fceb38 100644 --- a/schemas/post.json +++ b/schemas/post.json @@ -31,10 +31,6 @@ "filter" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "ID": { "readOnly": true, "description": "Post ID.", diff --git a/schemas/query.json b/schemas/query.json index df6e1c1..b14e86c 100644 --- a/schemas/query.json +++ b/schemas/query.json @@ -51,10 +51,6 @@ "thumbnails_cached" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "query": { "description": "Query vars set by the user.", "type": [ diff --git a/schemas/rest-api/term.json b/schemas/rest-api/term.json index fc6063a..8a3e325 100644 --- a/schemas/rest-api/term.json +++ b/schemas/rest-api/term.json @@ -16,10 +16,6 @@ "_links" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "id": { "readOnly": true, "description": "Unique identifier for the term.", diff --git a/schemas/role.json b/schemas/role.json index 6ebba3f..690ab2a 100644 --- a/schemas/role.json +++ b/schemas/role.json @@ -10,10 +10,6 @@ "capabilities" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "name": { "description": "Role name.", "anyOf": [ diff --git a/schemas/site.json b/schemas/site.json index fd71328..30fe4dc 100644 --- a/schemas/site.json +++ b/schemas/site.json @@ -19,10 +19,6 @@ "lang_id" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "blog_id": { "readOnly": true, "description": "Site ID.\n\nA numeric string, for compatibility reasons.", diff --git a/schemas/taxonomy.json b/schemas/taxonomy.json index 1cf3c89..a334097 100644 --- a/schemas/taxonomy.json +++ b/schemas/taxonomy.json @@ -37,10 +37,6 @@ "_builtin" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "name": { "description": "Taxonomy key.", "anyOf": [ diff --git a/schemas/term.json b/schemas/term.json index ec60a77..e491c88 100644 --- a/schemas/term.json +++ b/schemas/term.json @@ -17,10 +17,6 @@ "filter" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "term_id": { "readOnly": true, "description": "Term ID.", diff --git a/schemas/user.json b/schemas/user.json index 8f4c9ee..8162caa 100644 --- a/schemas/user.json +++ b/schemas/user.json @@ -14,10 +14,6 @@ "roles" ], "properties": { - "$schema": { - "description": "JSON schema definition.", - "type": "string" - }, "ID": { "readOnly": true, "description": "The user's ID.", diff --git a/tests/mu-plugins/mu-plugin.php b/tests/mu-plugins/mu-plugin.php index e9ac11c..c7be522 100644 --- a/tests/mu-plugins/mu-plugin.php +++ b/tests/mu-plugins/mu-plugin.php @@ -42,10 +42,6 @@ * @param string $dir The directory to save the files. */ function save_object_array( array $data, string $dir ) : void { - $schema = sprintf( - '../../../schemas/%s.json', - $dir - ); $dir = dirname( ABSPATH ) . '/data/' . $dir; if ( ! file_exists( $dir ) ) { @@ -57,13 +53,6 @@ function save_object_array( array $data, string $dir ) : void { $item = get_object_vars( $item ); } - $item = array_merge( - [ - '$schema' => $schema, - ], - $item - ); - $json = json_encode( $item, JSON_PRETTY_PRINT ^ JSON_UNESCAPED_SLASHES ); file_put_contents( $dir . '/' . $i . '.json', $json ); From 8c6afa7b72790f0cef7f1584bb8977132400be95 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 9 Apr 2023 17:18:41 +0100 Subject: [PATCH 03/62] Add tests for post type labels and taxonomy labels. Fixes #58. --- tests/bin/test.sh | 3 +++ tests/output/properties.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/output/properties.php diff --git a/tests/bin/test.sh b/tests/bin/test.sh index 12115d6..6606b94 100755 --- a/tests/bin/test.sh +++ b/tests/bin/test.sh @@ -47,3 +47,6 @@ do fi ./node_modules/node-jq/bin/jq --tab 'del(.additionalProperties)' "$file" > tmp && mv tmp "$file" done + +validate_schema schemas/properties/post-type-labels.json +validate_schema schemas/properties/taxonomy-labels.json diff --git a/tests/output/properties.php b/tests/output/properties.php new file mode 100644 index 0000000..3d84651 --- /dev/null +++ b/tests/output/properties.php @@ -0,0 +1,14 @@ + Date: Sun, 9 Apr 2023 22:24:40 +0100 Subject: [PATCH 04/62] These tests are redundant. --- tests/bin/test.sh | 3 --- tests/output/properties.php | 14 -------------- 2 files changed, 17 deletions(-) delete mode 100644 tests/output/properties.php diff --git a/tests/bin/test.sh b/tests/bin/test.sh index 6606b94..12115d6 100755 --- a/tests/bin/test.sh +++ b/tests/bin/test.sh @@ -47,6 +47,3 @@ do fi ./node_modules/node-jq/bin/jq --tab 'del(.additionalProperties)' "$file" > tmp && mv tmp "$file" done - -validate_schema schemas/properties/post-type-labels.json -validate_schema schemas/properties/taxonomy-labels.json diff --git a/tests/output/properties.php b/tests/output/properties.php deleted file mode 100644 index 3d84651..0000000 --- a/tests/output/properties.php +++ /dev/null @@ -1,14 +0,0 @@ - Date: Sun, 9 Apr 2023 23:55:27 +0100 Subject: [PATCH 05/62] Add schemas for block patterns. --- packages/wp-types/index.ts | 80 +++++++++++++++++ packages/wp-types/readme.md | 4 +- readme.md | 4 +- schema.json | 16 ++++ schemas/rest-api/block-pattern-category.json | 38 ++++++++ schemas/rest-api/block-pattern.json | 87 +++++++++++++++++++ .../collections/block-pattern-categories.json | 19 ++++ .../rest-api/collections/block-patterns.json | 19 ++++ tests/output/block-pattern-categories.php | 9 ++ tests/output/block-patterns.php | 9 ++ 10 files changed, 281 insertions(+), 4 deletions(-) create mode 100644 schemas/rest-api/block-pattern-category.json create mode 100644 schemas/rest-api/block-pattern.json create mode 100644 schemas/rest-api/collections/block-pattern-categories.json create mode 100644 schemas/rest-api/collections/block-patterns.json create mode 100644 tests/output/block-pattern-categories.php create mode 100644 tests/output/block-patterns.php diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 1b5fbe6..b5c2350 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -60,6 +60,14 @@ export type WP_REST_API_Blocks = WP_REST_API_Block[]; * A collection of block directory search results in a REST API context. */ export type WP_REST_API_Block_Directory_Items = WP_REST_API_Block_Directory_Item[]; +/** + * A collection of block pattern categories in a REST API context. + */ +export type WP_REST_API_Block_Pattern_Categories = WP_REST_API_Block_Pattern_Category[]; +/** + * A collection of block patterns in a REST API context. + */ +export type WP_REST_API_Block_Patterns = WP_REST_API_Block_Pattern[]; /** * A collection of block type objects in a REST API context. */ @@ -137,6 +145,10 @@ export interface WP { Blocks: WP_REST_API_Blocks; Block_Directory_Item: WP_REST_API_Block_Directory_Item; Block_Directory_Items: WP_REST_API_Block_Directory_Items; + Block_Pattern_Category: WP_REST_API_Block_Pattern_Category; + Block_Pattern_Categories: WP_REST_API_Block_Pattern_Categories; + Block_Pattern: WP_REST_API_Block_Pattern; + Block_Patterns: WP_REST_API_Block_Patterns; Block_Type: WP_REST_API_Block_Type; Block_Types: WP_REST_API_Block_Types; Revision: WP_REST_API_Revision; @@ -2240,6 +2252,74 @@ export interface WP_REST_API_Block_Directory_Item { _links: WP_REST_API_Object_Links; [k: string]: unknown; } +/** + * A block pattern category in a REST API context. + */ +export interface WP_REST_API_Block_Pattern_Category { + /** + * The category name. + */ + name: string; + /** + * The category label, in human readable format. + */ + label: string; + /** + * The category description, in human readable format. + */ + description?: string; + [k: string]: unknown; +} +/** + * A block pattern in a REST API context. + */ +export interface WP_REST_API_Block_Pattern { + /** + * The pattern name, in namespace/pattern-name format. + */ + name: string; + /** + * The pattern title, in human readable format. + */ + title: string; + /** + * The pattern content. + */ + content: string; + /** + * The pattern detailed description. + */ + description?: string; + /** + * The pattern viewport width for inserter preview. + */ + viewport_width?: number; + /** + * Determines whether the pattern is visible in inserter. + */ + inserter?: boolean; + /** + * The pattern category slugs. + */ + categories?: string[]; + /** + * The pattern keywords. + */ + keywords?: string[]; + /** + * Block types that the pattern is intended to be used with. + */ + block_types?: string[]; + /** + * An array of post types that the pattern is restricted to be used with. + */ + post_types?: string[]; + /** + * An array of template types where the pattern fits. + */ + template_types?: string[]; + [k: string]: unknown; +} /** * A block type object in a REST API context. */ diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 97236c5..39a3d89 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -34,8 +34,8 @@ The definitions were last updated for WordPress 6.2. Route | Schema ------------------------------------------------------- | ------ /wp/v2/block-directory/search | `WP_REST_API_Block_Directory_Items` -/wp/v2/block-patterns/categories | Todo -/wp/v2/block-patterns/patterns | Todo +/wp/v2/block-patterns/categories | `WP_REST_API_Block_Pattern_Categories` +/wp/v2/block-patterns/patterns | `WP_REST_API_Block_Patterns` /wp/v2/block-renderer/{name} | `WP_REST_API_Rendered_Block` /wp/v2/block-types | `WP_REST_API_Block_Types` /wp/v2/block-types/{namespace} | `WP_REST_API_Block_Type` diff --git a/readme.md b/readme.md index 4cf551f..bb64e2a 100644 --- a/readme.md +++ b/readme.md @@ -38,8 +38,8 @@ The schemas were last updated for WordPress 6.2. Route | Schema ------------------------------------------------------- | ------ /wp/v2/block-directory/search | `WP_REST_API_Block_Directory_Items` -/wp/v2/block-patterns/categories | Todo -/wp/v2/block-patterns/patterns | Todo +/wp/v2/block-patterns/categories | `WP_REST_API_Block_Pattern_Categories` +/wp/v2/block-patterns/patterns | `WP_REST_API_Block_Patterns` /wp/v2/block-renderer/{name} | `WP_REST_API_Rendered_Block` /wp/v2/block-types | `WP_REST_API_Block_Types` /wp/v2/block-types/{namespace} | `WP_REST_API_Block_Type` diff --git a/schema.json b/schema.json index df9947c..eda03da 100644 --- a/schema.json +++ b/schema.json @@ -101,6 +101,18 @@ "Block_Directory_Items": { "$ref": "schemas/rest-api/collections/block-directory-items.json" }, + "Block_Pattern_Category": { + "$ref": "schemas/rest-api/block-pattern-category.json" + }, + "Block_Pattern_Categories": { + "$ref": "schemas/rest-api/collections/block-pattern-categories.json" + }, + "Block_Pattern": { + "$ref": "schemas/rest-api/block-pattern.json" + }, + "Block_Patterns": { + "$ref": "schemas/rest-api/collections/block-patterns.json" + }, "Block_Type": { "$ref": "schemas/rest-api/block-type.json" }, @@ -188,6 +200,10 @@ "Attachments", "Block_Directory_Item", "Block_Directory_Items", + "Block_Pattern_Category", + "Block_Pattern_Categories", + "Block_Pattern", + "Block_Patterns", "Block_Type", "Block_Types", "Block", diff --git a/schemas/rest-api/block-pattern-category.json b/schemas/rest-api/block-pattern-category.json new file mode 100644 index 0000000..b8e9724 --- /dev/null +++ b/schemas/rest-api/block-pattern-category.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/block-pattern-category.json", + "title": "WP_REST_API_Block_Pattern_Category", + "description": "A block pattern category in a REST API context.", + "type": "object", + "readOnly": true, + "required": [ + "name", + "label" + ], + "properties": { + "name": { + "description": "The category name.", + "type": "string" + }, + "label": { + "description": "The category label, in human readable format.", + "type": "string" + }, + "description": { + "description": "The category description, in human readable format.", + "type": "string" + } + }, + "links": [ + { + "rel": "collection", + "href": "/wp/v2/block-patterns/categories", + "targetSchema": { + "type": "array", + "items": { + "$ref": "#" + } + } + } + ] +} diff --git a/schemas/rest-api/block-pattern.json b/schemas/rest-api/block-pattern.json new file mode 100644 index 0000000..cc60ff9 --- /dev/null +++ b/schemas/rest-api/block-pattern.json @@ -0,0 +1,87 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/block-pattern.json", + "title": "WP_REST_API_Block_Pattern", + "description": "A block pattern in a REST API context.", + "type": "object", + "readOnly": true, + "required": [ + "name", + "title", + "content" + ], + "properties": { + "name": { + "description": "The pattern name, in namespace/pattern-name format.", + "type": "string" + }, + "title": { + "description": "The pattern title, in human readable format.", + "type": "string" + }, + "content": { + "description": "The pattern content.", + "contentMediaType": "text/html", + "type": "string" + }, + "description": { + "description": "The pattern detailed description.", + "type": "string" + }, + "viewport_width": { + "description": "The pattern viewport width for inserter preview.", + "type": "number" + }, + "inserter": { + "description": "Determines whether the pattern is visible in inserter.", + "type": "boolean" + }, + "categories": { + "description": "The pattern category slugs.", + "type": "array", + "items": { + "type": "string" + } + }, + "keywords": { + "description": "The pattern keywords.", + "type": "array", + "items": { + "type": "string" + } + }, + "block_types": { + "description": "Block types that the pattern is intended to be used with.", + "type": "array", + "items": { + "type": "string" + } + }, + "post_types": { + "description": "An array of post types that the pattern is restricted to be used with.", + "type": "array", + "items": { + "type": "string" + } + }, + "template_types": { + "description": "An array of template types where the pattern fits.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "links": [ + { + "rel": "collection", + "href": "/wp/v2/block-patterns/patterns", + "targetSchema": { + "type": "array", + "items": { + "$ref": "#" + } + } + } + ] +} diff --git a/schemas/rest-api/collections/block-pattern-categories.json b/schemas/rest-api/collections/block-pattern-categories.json new file mode 100644 index 0000000..42919db --- /dev/null +++ b/schemas/rest-api/collections/block-pattern-categories.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/block-pattern-categories.json", + "title": "WP_REST_API_Block_Pattern_Categories", + "description": "A collection of block pattern categories in a REST API context.", + "type": "array", + "items": { + "$ref": "../block-pattern-category.json" + }, + "links": [ + { + "rel": "self", + "href": "/wp/v2/block-patterns/categories", + "targetSchema": { + "$ref": "#" + } + } + ] +} diff --git a/schemas/rest-api/collections/block-patterns.json b/schemas/rest-api/collections/block-patterns.json new file mode 100644 index 0000000..673caab --- /dev/null +++ b/schemas/rest-api/collections/block-patterns.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/block-patterns.json", + "title": "WP_REST_API_Block_Patterns", + "description": "A collection of block patterns in a REST API context.", + "type": "array", + "items": { + "$ref": "../block-pattern.json" + }, + "links": [ + { + "rel": "self", + "href": "/wp/v2/block-patterns/patterns", + "targetSchema": { + "$ref": "#" + } + } + ] +} diff --git a/tests/output/block-pattern-categories.php b/tests/output/block-pattern-categories.php new file mode 100644 index 0000000..53a2f29 --- /dev/null +++ b/tests/output/block-pattern-categories.php @@ -0,0 +1,9 @@ + Date: Sun, 9 Apr 2023 23:55:44 +0100 Subject: [PATCH 06/62] Move this into a subdirectory. --- tests/output/block.php | 2 +- tests/output/{ => includes}/blocks.html | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/output/{ => includes}/blocks.html (100%) diff --git a/tests/output/block.php b/tests/output/block.php index 9e4ac46..05502d7 100644 --- a/tests/output/block.php +++ b/tests/output/block.php @@ -2,7 +2,7 @@ namespace WPJsonSchemas; -$content = file_get_contents( __DIR__ . '/blocks.html' ); +$content = file_get_contents( __DIR__ . '/includes/blocks.html' ); $parsed = array_filter( parse_blocks( $content ), function( $block ) { return ! empty( $block['blockName'] ); } ); diff --git a/tests/output/blocks.html b/tests/output/includes/blocks.html similarity index 100% rename from tests/output/blocks.html rename to tests/output/includes/blocks.html From 519189c7b2fb7e20732ea8a8c46f2b6c058c4676 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 10 Apr 2023 00:27:48 +0100 Subject: [PATCH 07/62] Reset the locale after generating the test data for each one. --- tests/output/locale.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/output/locale.php b/tests/output/locale.php index 5ed6daf..471ea9c 100644 --- a/tests/output/locale.php +++ b/tests/output/locale.php @@ -11,6 +11,7 @@ foreach ( $translations as $locale ) { switch_to_locale( $locale ); $locales[ $locale ] = $GLOBALS['wp_locale']; + restore_previous_locale(); } save_object_array( $locales, 'locale' ); From b5d2860d5f3d5dab0fa2c3aa67cf2f85ff2c8f23 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 10 Apr 2023 00:43:02 +0100 Subject: [PATCH 08/62] Tweaks to and more tests for the revision schema. --- packages/wp-types/index.ts | 2 +- packages/wp-types/readme.md | 4 +-- readme.md | 4 +-- schemas/rest-api/revision.json | 1 - tests/output/revision.php | 56 +++++++++++++++++++--------------- 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index b5c2350..8c8c7aa 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -2588,7 +2588,7 @@ export interface WP_REST_API_Revision { /** * The excerpt for the post. */ - excerpt: { + excerpt?: { /** * Excerpt for the post, as it exists in the database. Only present when using the 'edit' context. */ diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 39a3d89..21fd3ae 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -44,8 +44,8 @@ Route | Schema /wp/v2/blocks/{id} | `WP_REST_API_Block` /wp/v2/blocks/{id}/autosaves | Todo /wp/v2/blocks/{parent}/autosaves/{id} | Todo -/wp/v2/blocks/{parent}/revisions | Todo -/wp/v2/blocks/{parent}/revisions/{id} | Todo +/wp/v2/blocks/{parent}/revisions | `WP_REST_API_Revisions` +/wp/v2/blocks/{parent}/revisions/{id} | `WP_REST_API_Revision` /wp/v2/categories | `WP_REST_API_Categories` /wp/v2/categories/{id} | `WP_REST_API_Category` /wp/v2/comments | `WP_REST_API_Comments` diff --git a/readme.md b/readme.md index bb64e2a..4b920c3 100644 --- a/readme.md +++ b/readme.md @@ -48,8 +48,8 @@ Route | Schema /wp/v2/blocks/{id} | `WP_REST_API_Block` /wp/v2/blocks/{id}/autosaves | Todo /wp/v2/blocks/{parent}/autosaves/{id} | Todo -/wp/v2/blocks/{parent}/revisions | Todo -/wp/v2/blocks/{parent}/revisions/{id} | Todo +/wp/v2/blocks/{parent}/revisions | `WP_REST_API_Revisions` +/wp/v2/blocks/{parent}/revisions/{id} | `WP_REST_API_Revision` /wp/v2/categories | `WP_REST_API_Categories` /wp/v2/categories/{id} | `WP_REST_API_Category` /wp/v2/comments | `WP_REST_API_Comments` diff --git a/schemas/rest-api/revision.json b/schemas/rest-api/revision.json index afb50bb..426fced 100644 --- a/schemas/rest-api/revision.json +++ b/schemas/rest-api/revision.json @@ -16,7 +16,6 @@ "slug", "title", "content", - "excerpt", "_links" ], "properties": { diff --git a/tests/output/revision.php b/tests/output/revision.php index 151ce6a..b415e36 100644 --- a/tests/output/revision.php +++ b/tests/output/revision.php @@ -2,31 +2,37 @@ namespace WPJsonSchemas; -$id = wp_insert_post( [ - 'post_type' => 'post', - 'post_title' => 'Title', - 'post_status' => 'publish', -] ); +$endpoints = [ + 'page' => 'pages', + 'post' => 'posts', + 'wp_block' => 'blocks', +]; +$data = []; -wp_update_post( [ - 'ID' => $id, - 'post_title' => 'Hello 2', -] ); -wp_update_post( [ - 'ID' => $id, - 'post_title' => 'Hello 3', -] ); +foreach ( $endpoints as $post_type => $slug ) { + $id = wp_insert_post( [ + 'post_type' => $post_type, + 'post_title' => 'Title', + 'post_status' => 'publish', + ] ); -$view_data = get_rest_response( 'GET', "/wp/v2/posts/{$id}/revisions", [ - 'context' => 'view', - 'per_page' => 100, -] ); -$edit_data = get_rest_response( 'GET', "/wp/v2/posts/{$id}/revisions", [ - 'context' => 'edit', - 'per_page' => 100, -] ); + wp_update_post( [ + 'ID' => $id, + 'post_title' => 'Hello 2', + ] ); + wp_update_post( [ + 'ID' => $id, + 'post_title' => 'Hello 3', + ] ); -save_rest_array( [ - $view_data, - $edit_data, -], 'revisions' ); + $data[] = get_rest_response( 'GET', "/wp/v2/{$slug}/{$id}/revisions", [ + 'context' => 'view', + 'per_page' => 100, + ] ); + $data[] = get_rest_response( 'GET', "/wp/v2/{$slug}/{$id}/revisions", [ + 'context' => 'edit', + 'per_page' => 100, + ] ); +} + +save_rest_array( $data, 'revisions' ); From 5e6790294041bb403ed2709af50e1efbdb478e77 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 10 Apr 2023 00:55:15 +0100 Subject: [PATCH 09/62] Docs. --- packages/wp-types/readme.md | 2 +- readme.md | 2 +- ...on => wp-v2-global-styles-themes-stylesheet-variations.json} | 0 tests/output/routes.php | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename tests/data/rest-api/routes/{wp-v2-global-styles-themes-stylesheet-s-variations.json => wp-v2-global-styles-themes-stylesheet-variations.json} (100%) diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 21fd3ae..76aaefb 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -50,7 +50,7 @@ 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/global-styles | Todo +/wp/v2/global-styles/{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 4b920c3..832b604 100644 --- a/readme.md +++ b/readme.md @@ -54,7 +54,7 @@ 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/global-styles | Todo +/wp/v2/global-styles/{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/wp-v2-global-styles-themes-stylesheet-s-variations.json b/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet-variations.json similarity index 100% rename from tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet-s-variations.json rename to tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet-variations.json diff --git a/tests/output/routes.php b/tests/output/routes.php index 261c30d..7a8a028 100644 --- a/tests/output/routes.php +++ b/tests/output/routes.php @@ -20,7 +20,7 @@ foreach ( $routes as $item ) { $i = preg_replace( '#[^a-z0-9]+#', '-', $item['route'] ); - $i = preg_replace( '#\b[dw]\b#', '', $i ); + $i = preg_replace( '#\b[dsw]\b#', '', $i ); $i = str_replace( 'a-z', '', $i ); $i = str_replace( '0-9', '', $i ); $i = preg_replace( '#\-+#', '-', $i ); From 63650d7568ba9b9d5ac9a2b41186fb359a1c5997 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 10 Apr 2023 00:56:19 +0100 Subject: [PATCH 10/62] 3.62.2 --- package.json | 2 +- packages/wp-types/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 56a0f6e..93ecb89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-json-schemas", - "version": "3.62.1", + "version": "3.62.2", "description": "JSON schemas for WordPress PHP objects and REST API responses", "main": "schema.json", "files": [ diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index 80fa38c..4b8a5ee 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -1,6 +1,6 @@ { "name": "wp-types", - "version": "3.62.1", + "version": "3.62.2", "description": "TypeScript definitions of WordPress PHP objects and REST API responses.", "main": "", "types": "index.ts", From d03e53ba5cb12fc652c84e60ab06bbafc60f3f37 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 10 Apr 2023 01:24:15 +0100 Subject: [PATCH 11/62] This is redundant. --- tests/output/type.php | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 tests/output/type.php diff --git a/tests/output/type.php b/tests/output/type.php deleted file mode 100644 index 109b9e0..0000000 --- a/tests/output/type.php +++ /dev/null @@ -1,15 +0,0 @@ - 'view', -] ); - -save_rest_array( [ - $data -], 'types' ); From 920a5df506656eae9ac60197b8e499baab891f78 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 10 Apr 2023 01:55:28 +0100 Subject: [PATCH 12/62] More specific types for locales. --- packages/wp-types/index.ts | 26 ++++++++- schemas/locale.json | 112 +++++++++++++++++++++++++++++++++++-- 2 files changed, 130 insertions(+), 8 deletions(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 8c8c7aa..f281c44 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -534,13 +534,35 @@ export interface WP_Locale { * Stores the translated strings for the full month names. */ month: { - [k: string]: string; + "10": string; + "11": string; + "12": string; + "01": string; + "02": string; + "03": string; + "04": string; + "05": string; + "06": string; + "07": string; + "08": string; + "09": string; }; /** * Stores the translated strings for the month names in genitive case, if the locale specifies. */ month_genitive: { - [k: string]: string; + "10": string; + "11": string; + "12": string; + "01": string; + "02": string; + "03": string; + "04": string; + "05": string; + "06": string; + "07": string; + "08": string; + "09": string; }; /** * Stores the translated strings for the abbreviated month names. diff --git a/schemas/locale.json b/schemas/locale.json index 541b972..e392d74 100644 --- a/schemas/locale.json +++ b/schemas/locale.json @@ -46,16 +46,116 @@ "month": { "description": "Stores the translated strings for the full month names.", "type": "object", - "additionalProperties": { - "type": "string" - } + "required": [ + "01", + "02", + "03", + "04", + "05", + "06", + "07", + "08", + "09", + "10", + "11", + "12" + ], + "properties": { + "01": { + "type": "string" + }, + "02": { + "type": "string" + }, + "03": { + "type": "string" + }, + "04": { + "type": "string" + }, + "05": { + "type": "string" + }, + "06": { + "type": "string" + }, + "07": { + "type": "string" + }, + "08": { + "type": "string" + }, + "09": { + "type": "string" + }, + "10": { + "type": "string" + }, + "11": { + "type": "string" + }, + "12": { + "type": "string" + } + }, + "additionalProperties": false }, "month_genitive": { "description": "Stores the translated strings for the month names in genitive case, if the locale specifies.", "type": "object", - "additionalProperties": { - "type": "string" - } + "required": [ + "01", + "02", + "03", + "04", + "05", + "06", + "07", + "08", + "09", + "10", + "11", + "12" + ], + "properties": { + "01": { + "type": "string" + }, + "02": { + "type": "string" + }, + "03": { + "type": "string" + }, + "04": { + "type": "string" + }, + "05": { + "type": "string" + }, + "06": { + "type": "string" + }, + "07": { + "type": "string" + }, + "08": { + "type": "string" + }, + "09": { + "type": "string" + }, + "10": { + "type": "string" + }, + "11": { + "type": "string" + }, + "12": { + "type": "string" + } + }, + "additionalProperties": false }, "month_abbrev": { "description": "Stores the translated strings for the abbreviated month names.", From a6f64064f46e5aff0028cc12689ec17908aa3e3d Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 10 Apr 2023 01:55:50 +0100 Subject: [PATCH 13/62] More specific types for post types in a REST API context. --- packages/wp-types/index.ts | 9 ++++++++- schemas/rest-api/type.json | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index f281c44..7294670 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -3091,7 +3091,14 @@ export interface WP_REST_API_Type { * The visibility settings for the post type. Only present when using the 'edit' context. */ visibility?: { - [k: string]: unknown; + /** + * Whether to generate a default UI for managing this post type. + */ + show_ui?: boolean; + /** + * Whether to make the post type available for selection in navigation menus. + */ + show_in_nav_menus?: boolean; }; /** * The icon for the post type. diff --git a/schemas/rest-api/type.json b/schemas/rest-api/type.json index 0b94112..6b0ac80 100644 --- a/schemas/rest-api/type.json +++ b/schemas/rest-api/type.json @@ -100,7 +100,18 @@ }, "visibility": { "description": "The visibility settings for the post type. Only present when using the 'edit' context.", - "type": "object" + "type": "object", + "properties": { + "show_ui": { + "description": "Whether to generate a default UI for managing this post type.", + "type": "boolean" + }, + "show_in_nav_menus": { + "description": "Whether to make the post type available for selection in navigation menus.", + "type": "boolean" + } + }, + "additionalProperties": false }, "icon": { "description": "The icon for the post type.", From 162276c4bbcabe377339a5e3d2564b236fe38840 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 11 Apr 2023 22:07:24 +0100 Subject: [PATCH 14/62] Increase the precision of the envelope response definition. --- packages/wp-types/append.ts | 7 +++++-- packages/wp-types/index.ts | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/wp-types/append.ts b/packages/wp-types/append.ts index 95b1130..87932c2 100644 --- a/packages/wp-types/append.ts +++ b/packages/wp-types/append.ts @@ -2,7 +2,7 @@ type ValueOf = T[keyof T] /** - * An enveloped REST API response. + * An enveloped REST API response (with `?_envelope`). * * @template T A REST API response type. */ @@ -18,5 +18,8 @@ export interface WP_REST_API_Envelope> { /** * The HTTP headers */ - headers: object; + headers: { + [k: string]: string|number; + }; + [k: string]: unknown; } diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 7294670..f7a86d7 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -3319,7 +3319,7 @@ export const enum WP_Http_Status_Code { type ValueOf = T[keyof T] /** - * An enveloped REST API response. + * An enveloped REST API response (with `?_envelope`). * * @template T A REST API response type. */ @@ -3335,5 +3335,8 @@ export interface WP_REST_API_Envelope> { /** * The HTTP headers */ - headers: object; + headers: { + [k: string]: string|number; + }; + [k: string]: unknown; } From 77177899038150a8302359870eac327caecb8f4a Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 12 Apr 2023 00:00:47 +0100 Subject: [PATCH 15/62] Add a schema for `WP_Screen`. --- packages/wp-types/index.ts | 46 +++++++++++++++++++++++++ packages/wp-types/readme.md | 1 + readme.md | 1 + schema.json | 4 +++ schemas/screen.json | 68 +++++++++++++++++++++++++++++++++++++ tests/output/screen.php | 31 +++++++++++++++++ 6 files changed, 151 insertions(+) create mode 100644 schemas/screen.json create mode 100644 tests/output/screen.php diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index f7a86d7..e0cee92 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -128,6 +128,7 @@ export interface WP { Post_Type: WP_Post_Type; Query: WP_Query; Role: WP_Role; + Screen: WP_Screen; Site: WP_Site; Taxonomy: WP_Taxonomy; Term: WP_Term; @@ -1354,6 +1355,51 @@ export interface WP_Role { */ capabilities: WP_User_Caps; } +/** + * Core class used to implement an admin screen API. + */ +export interface WP_Screen { + /** + * Any action associated with the screen. + */ + action: string; + /** + * The base type of the screen. + */ + base: string; + /** + * The unique ID of the screen. + */ + id: string; + /** + * Whether the screen is in the network admin. + */ + is_network: boolean; + /** + * Whether the screen is in the user admin. + */ + is_user: boolean; + /** + * The base menu parent. + */ + parent_base: string | null; + /** + * The parent_file for the screen per the admin menu system. + */ + parent_file: string | null; + /** + * The post type associated with the screen, if any. + */ + post_type: string; + /** + * The taxonomy associated with the screen, if any. + */ + taxonomy: string; + /** + * The help tab data associated with the screen, if any. + */ + is_block_editor: boolean; +} /** * Core class used for interacting with a multisite site. */ diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 76aaefb..1ffb6ab 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -28,6 +28,7 @@ The definitions were last updated for WordPress 6.2. * `WP_Post_Type` * `WP_Role` * `WP_Network` +* `WP_Screen` ### Interfaces for REST API response objects diff --git a/readme.md b/readme.md index 832b604..676ae51 100644 --- a/readme.md +++ b/readme.md @@ -32,6 +32,7 @@ The schemas were last updated for WordPress 6.2. * `WP_Post_Type` * `WP_Role` * `WP_Network` +* `WP_Screen` ### REST API Response Schemas diff --git a/schema.json b/schema.json index eda03da..3b7e72a 100644 --- a/schema.json +++ b/schema.json @@ -50,6 +50,9 @@ "Role": { "$ref": "schemas/role.json" }, + "Screen": { + "$ref": "schemas/screen.json" + }, "Site": { "$ref": "schemas/site.json" }, @@ -247,6 +250,7 @@ "Post_Type", "Query", "Role", + "Screen", "Site", "Taxonomy", "Term", diff --git a/schemas/screen.json b/schemas/screen.json new file mode 100644 index 0000000..f6bd05c --- /dev/null +++ b/schemas/screen.json @@ -0,0 +1,68 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/screen.json", + "title": "WP_Screen", + "description": "Core class used to implement an admin screen API.", + "type": "object", + "required": [ + "action", + "base", + "id", + "is_network", + "is_user", + "parent_base", + "parent_file", + "post_type", + "taxonomy", + "is_block_editor" + ], + "properties": { + "action": { + "description": "Any action associated with the screen.", + "type": "string" + }, + "base": { + "description": "The base type of the screen.", + "type": "string" + }, + "id": { + "description": "The unique ID of the screen.", + "type": "string" + }, + "is_network": { + "description": "Whether the screen is in the network admin.", + "type": "boolean" + }, + "is_user": { + "description": "Whether the screen is in the user admin.", + "type": "boolean" + }, + "parent_base": { + "description": "The base menu parent.", + "type": [ + "string", + "null" + ] + }, + "parent_file": { + "description": "The parent_file for the screen per the admin menu system.", + "type": [ + "string", + "null" + ] + }, + "post_type": { + "description": "The post type associated with the screen, if any.", + "type": "string" + }, + "taxonomy": { + "description": "The taxonomy associated with the screen, if any.", + "type": "string" + }, + "is_block_editor": { + "description": "The help tab data associated with the screen, if any.", + "type": "boolean" + } + }, + "additionalProperties": false +} diff --git a/tests/output/screen.php b/tests/output/screen.php new file mode 100644 index 0000000..bf9af75 --- /dev/null +++ b/tests/output/screen.php @@ -0,0 +1,31 @@ +set_parentage( 'tools.php?page=my_plugin_page' ); + +$post_with_parent = WP_Screen::get( 'edit.php' ); +$post_with_parent->set_parentage( 'edit.php?post_type=page' ); + +$screens = [ + WP_Screen::get( 'ajax' ), + WP_Screen::get( 'customize' ), + WP_Screen::get( 'dashboard-network' ), + WP_Screen::get( 'dashboard-user' ), + WP_Screen::get( 'dashboard' ), + WP_Screen::get( 'edit-page' ), + WP_Screen::get( 'edit-post' ), + WP_Screen::get( 'edit.php' ), + WP_Screen::get( 'edit' ), + WP_Screen::get( 'front' ), + WP_Screen::get( 'nav-menu.php' ), + WP_Screen::get( 'tools.php' ), + WP_Screen::get( 'widgets.php' ), + $tools_with_parent, + $post_with_parent, +]; + +save_object_array( $screens, 'screen' ); From 27d1f9d1830a5ab3db2cf1e995e6fd76698322e9 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 12 Apr 2023 00:02:01 +0100 Subject: [PATCH 16/62] 3.62.3 --- package.json | 2 +- packages/wp-types/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 93ecb89..6d67eb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-json-schemas", - "version": "3.62.2", + "version": "3.62.3", "description": "JSON schemas for WordPress PHP objects and REST API responses", "main": "schema.json", "files": [ diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index 4b8a5ee..8c24709 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -1,6 +1,6 @@ { "name": "wp-types", - "version": "3.62.2", + "version": "3.62.3", "description": "TypeScript definitions of WordPress PHP objects and REST API responses.", "main": "", "types": "index.ts", From c5f8694f0a8b060d0eeb56123c5a9836eb976fc9 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 23 Apr 2023 00:38:24 +0200 Subject: [PATCH 17/62] Explicitly add `WP_Block_Type` to the schema (it's there implicitly via `WP_Block`). --- packages/wp-types/index.ts | 1 + schema.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index e0cee92..c3628d4 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -118,6 +118,7 @@ export type WP_REST_API_Application_Passwords = WP_REST_API_Application_Password */ export interface WP { Block: WP_Block; + Block_Type: WP_Block_Type; Comment: WP_Comment; Error: WP_Error; Error_With_Error: WP_Error_With_Error; diff --git a/schema.json b/schema.json index 3b7e72a..2a7db7a 100644 --- a/schema.json +++ b/schema.json @@ -20,6 +20,9 @@ "Block": { "$ref": "schemas/block.json" }, + "Block_Type": { + "$ref": "schemas/block-type.json" + }, "Comment": { "$ref": "schemas/comment.json" }, @@ -240,6 +243,7 @@ }, "required": [ "Block", + "Block_Type", "Comment", "Error", "Error_With_Error", From 415d1d3f61fcfafc63ec696cbeafa10b188516f6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 23 Apr 2023 00:38:49 +0200 Subject: [PATCH 18/62] Add a schema for `WP_Block_Template`. --- packages/wp-types/index.ts | 22 ++++++++ packages/wp-types/readme.md | 1 + readme.md | 1 + schema.json | 4 ++ schemas/block-template.json | 94 +++++++++++++++++++++++++++++++++ tests/output/block-template.php | 8 +++ 6 files changed, 130 insertions(+) create mode 100644 schemas/block-template.json create mode 100644 tests/output/block-template.php diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index c3628d4..50c5507 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -119,6 +119,7 @@ export type WP_REST_API_Application_Passwords = WP_REST_API_Application_Password export interface WP { Block: WP_Block; Block_Type: WP_Block_Type; + Block_Template: WP_Block_Template; Comment: WP_Comment; Error: WP_Error; Error_With_Error: WP_Error_With_Error; @@ -380,6 +381,27 @@ export interface WP_Block_Type { skip_inner_blocks?: boolean; } export interface EmptyObject {} +/** + * Core class representing a block template. + */ +export interface WP_Block_Template { + type: string; + theme: string; + slug: string; + id: string; + title: string; + content: string; + description: string; + source: string; + origin: string | null; + wp_id: number | null; + status: string; + has_theme_file: boolean; + is_custom: boolean; + author: number | null; + post_types: string[] | null; + area: string | null; +} /** * Core class used to organize comments as instantiated objects with defined members. */ diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 1ffb6ab..1946f94 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -22,6 +22,7 @@ The definitions were last updated for WordPress 6.2. * `WP_Query` * `WP_Block` * `WP_Block_Type` +* `WP_Block_Template` * `WP_Site` * `WP_Locale` * `WP_Taxonomy` diff --git a/readme.md b/readme.md index 676ae51..4ef482a 100644 --- a/readme.md +++ b/readme.md @@ -26,6 +26,7 @@ The schemas were last updated for WordPress 6.2. * `WP_Query` * `WP_Block` * `WP_Block_Type` +* `WP_Block_Template` * `WP_Site` * `WP_Locale` * `WP_Taxonomy` diff --git a/schema.json b/schema.json index 2a7db7a..49c6896 100644 --- a/schema.json +++ b/schema.json @@ -23,6 +23,9 @@ "Block_Type": { "$ref": "schemas/block-type.json" }, + "Block_Template": { + "$ref": "schemas/block-template.json" + }, "Comment": { "$ref": "schemas/comment.json" }, @@ -244,6 +247,7 @@ "required": [ "Block", "Block_Type", + "Block_Template", "Comment", "Error", "Error_With_Error", diff --git a/schemas/block-template.json b/schemas/block-template.json new file mode 100644 index 0000000..6c60389 --- /dev/null +++ b/schemas/block-template.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/block-template.json", + "title": "WP_Block_Template", + "description": "Core class representing a block template.", + "type": "object", + "required": [ + "type", + "theme", + "slug", + "id", + "title", + "content", + "description", + "source", + "origin", + "wp_id", + "status", + "has_theme_file", + "is_custom", + "author", + "post_types", + "area" + ], + "properties": { + "type": { + "type": "string" + }, + "theme": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "content": { + "type": "string" + }, + "description": { + "type": "string" + }, + "source": { + "type": "string" + }, + "origin": { + "type": [ + "string", + "null" + ] + }, + "wp_id": { + "type": [ + "integer", + "null" + ] + }, + "status": { + "type": "string" + }, + "has_theme_file": { + "type": "boolean" + }, + "is_custom": { + "type": "boolean" + }, + "author": { + "type": [ + "integer", + "null" + ] + }, + "post_types": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "area": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false +} diff --git a/tests/output/block-template.php b/tests/output/block-template.php new file mode 100644 index 0000000..93106cd --- /dev/null +++ b/tests/output/block-template.php @@ -0,0 +1,8 @@ + Date: Sun, 23 Apr 2023 00:38:55 +0200 Subject: [PATCH 19/62] This is an integer. --- schemas/rest-api/block-pattern.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/rest-api/block-pattern.json b/schemas/rest-api/block-pattern.json index cc60ff9..e4e8cc0 100644 --- a/schemas/rest-api/block-pattern.json +++ b/schemas/rest-api/block-pattern.json @@ -30,7 +30,7 @@ }, "viewport_width": { "description": "The pattern viewport width for inserter preview.", - "type": "number" + "type": "integer" }, "inserter": { "description": "Determines whether the pattern is visible in inserter.", From 10600b3d0fbb835b5b18c1f184708c70bda880e0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 23 Apr 2023 01:07:40 +0200 Subject: [PATCH 20/62] 3.62.4 --- package.json | 2 +- packages/wp-types/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6d67eb4..2b9c7f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-json-schemas", - "version": "3.62.3", + "version": "3.62.4", "description": "JSON schemas for WordPress PHP objects and REST API responses", "main": "schema.json", "files": [ diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index 8c24709..76d3977 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -1,6 +1,6 @@ { "name": "wp-types", - "version": "3.62.3", + "version": "3.62.4", "description": "TypeScript definitions of WordPress PHP objects and REST API responses.", "main": "", "types": "index.ts", From d1e942e5b9e5835572e3480d1e5e5ad4acf29db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 23 Apr 2023 08:27:43 +0200 Subject: [PATCH 21/62] Display TAB characters as 4 spaces --- .editorconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.editorconfig b/.editorconfig index e36d448..e99196b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,6 +6,7 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true indent_style = tab +indent_size = 4 [*.yml] indent_style = space From 6aaa9f51585f22dc91edaef6c1c85f415447b963 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 00:24:50 +0200 Subject: [PATCH 22/62] Docs. --- CONTRIBUTING.md | 12 ++++++++++++ readme.md | 1 + 2 files changed, 13 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e57af8c..71a87b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,6 +74,18 @@ The schema for a PHP object is created using the docblocks from its class proper * Run `npm run build-wp-types` and check the output of `packages/wp-types/index.ts`. * Add documentation for the schema in both `readme.md` and `packages/wp-types/readme.md`. +## Updating schemas for a new WordPress release + +* composer require --dev roots/wordpress-full=dev-main +* composer update +* composer test + +Address any test failures by updating the corresponding schema files. + +Address any newly added REST API routes by adding them to both readme files and adding a schema if necessary or documenting them as "Todo". + +For release, update the WordPress version number in composer.json and the readme files. + ## Releasing a new version * npm install diff --git a/readme.md b/readme.md index 4ef482a..aac5949 100644 --- a/readme.md +++ b/readme.md @@ -236,6 +236,7 @@ They're all tested against actual output from WordPress core. To run the tests: +* `nvm use` * `npm install` * `composer install` * `composer test` From 37c2b352eff3def707a06669dc1da21c67dad57e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 00:28:05 +0200 Subject: [PATCH 23/62] New REST API endpoint for global styles revisions. --- composer.json | 2 +- packages/wp-types/readme.md | 3 +- readme.md | 3 +- tests/data/rest-api/routes/routes.json | 1 + .../wp-v2-global-styles-parent-revisions.json | 51 +++++++++++++++++++ 5 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions.json diff --git a/composer.json b/composer.json index f3a0b56..63d4f87 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "require-dev": { "johnbillion/args": "1.7.0", "roots/wordpress-core-installer": "^1.0.0", - "roots/wordpress-full": "~6.2.0", + "roots/wordpress-full": "dev-main", "vlucas/phpdotenv": "^5", "wp-cli/core-command": "^2", "wp-cli/db-command": "^2", diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 1946f94..06270f7 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.2. +The definitions were last updated for WordPress 6.3. ## What's included? @@ -53,6 +53,7 @@ Route | Schema /wp/v2/comments | `WP_REST_API_Comments` /wp/v2/comments/{id} | `WP_REST_API_Comment` /wp/v2/global-styles/{id} | Todo +/wp/v2/global-styles/{id}/revisions | 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 aac5949..00862e9 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.2. +The schemas were last updated for WordPress 6.3. ## What's included? @@ -57,6 +57,7 @@ Route | Schema /wp/v2/comments | `WP_REST_API_Comments` /wp/v2/comments/{id} | `WP_REST_API_Comment` /wp/v2/global-styles/{id} | Todo +/wp/v2/global-styles/{id}/revisions | 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 e219742..7a3459e 100644 --- a/tests/data/rest-api/routes/routes.json +++ b/tests/data/rest-api/routes/routes.json @@ -18,6 +18,7 @@ "/wp/v2/comments", "/wp/v2/comments/(?P[\\d]+)", "/wp/v2/global-styles/(?P[\\/\\w-]+)", + "/wp/v2/global-styles/(?P[\\d]+)/revisions", "/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-global-styles-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions.json new file mode 100644 index 0000000..6217df3 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions.json @@ -0,0 +1,51 @@ +{ + "namespace": "wp/v2", + "methods": [ + "GET" + ], + "endpoints": [ + { + "methods": [ + "GET" + ], + "args": { + "parent": { + "description": "The ID for the parent of the revision.", + "type": "integer", + "required": false + }, + "context": { + "description": "Scope under which the request is made; determines fields present in response.", + "type": "string", + "enum": [ + "view", + "embed", + "edit" + ], + "default": "view", + "required": false + }, + "page": { + "description": "Current page of the collection.", + "type": "integer", + "default": 1, + "minimum": 1, + "required": false + }, + "per_page": { + "description": "Maximum number of items to be returned in result set.", + "type": "integer", + "minimum": 1, + "maximum": 100, + "required": false + }, + "offset": { + "description": "Offset the result set by a specific number of items.", + "type": "integer", + "required": false + } + } + } + ], + "route": "/wp/v2/global-styles/(?P[\\d]+)/revisions" +} \ No newline at end of file From 68884828ce166cb4adf40a4ae5cf82c9a751ce2c Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 01:00:48 +0200 Subject: [PATCH 24/62] Updated route definitions. --- tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json | 8 +++++++- tests/data/rest-api/routes/wp-v2-pages-id.json | 8 +++++++- tests/data/rest-api/routes/wp-v2-pages.json | 8 +++++++- tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json | 8 +++++++- tests/data/rest-api/routes/wp-v2-posts-id.json | 8 +++++++- tests/data/rest-api/routes/wp-v2-posts.json | 8 +++++++- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json index a38666a..2ea08df 100644 --- a/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json @@ -213,7 +213,13 @@ "meta": { "description": "Meta fields.", "type": "object", - "properties": [], + "properties": { + "footnotes": { + "type": "string", + "description": "", + "default": "" + } + }, "required": false }, "template": { diff --git a/tests/data/rest-api/routes/wp-v2-pages-id.json b/tests/data/rest-api/routes/wp-v2-pages-id.json index b6d06f7..f39939c 100644 --- a/tests/data/rest-api/routes/wp-v2-pages-id.json +++ b/tests/data/rest-api/routes/wp-v2-pages-id.json @@ -234,7 +234,13 @@ "meta": { "description": "Meta fields.", "type": "object", - "properties": [], + "properties": { + "footnotes": { + "type": "string", + "description": "", + "default": "" + } + }, "required": false }, "template": { diff --git a/tests/data/rest-api/routes/wp-v2-pages.json b/tests/data/rest-api/routes/wp-v2-pages.json index 8712395..f9ac6fb 100644 --- a/tests/data/rest-api/routes/wp-v2-pages.json +++ b/tests/data/rest-api/routes/wp-v2-pages.json @@ -397,7 +397,13 @@ "meta": { "description": "Meta fields.", "type": "object", - "properties": [], + "properties": { + "footnotes": { + "type": "string", + "description": "", + "default": "" + } + }, "required": false }, "template": { diff --git a/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json index 7b325b0..e6bdc5f 100644 --- a/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json @@ -225,7 +225,13 @@ "meta": { "description": "Meta fields.", "type": "object", - "properties": [], + "properties": { + "footnotes": { + "type": "string", + "description": "", + "default": "" + } + }, "required": false }, "sticky": { diff --git a/tests/data/rest-api/routes/wp-v2-posts-id.json b/tests/data/rest-api/routes/wp-v2-posts-id.json index f82bbc0..e25edd0 100644 --- a/tests/data/rest-api/routes/wp-v2-posts-id.json +++ b/tests/data/rest-api/routes/wp-v2-posts-id.json @@ -241,7 +241,13 @@ "meta": { "description": "Meta fields.", "type": "object", - "properties": [], + "properties": { + "footnotes": { + "type": "string", + "description": "", + "default": "" + } + }, "required": false }, "sticky": { diff --git a/tests/data/rest-api/routes/wp-v2-posts.json b/tests/data/rest-api/routes/wp-v2-posts.json index fc1041f..df5b5a5 100644 --- a/tests/data/rest-api/routes/wp-v2-posts.json +++ b/tests/data/rest-api/routes/wp-v2-posts.json @@ -558,7 +558,13 @@ "meta": { "description": "Meta fields.", "type": "object", - "properties": [], + "properties": { + "footnotes": { + "type": "string", + "description": "", + "default": "" + } + }, "required": false }, "sticky": { From cf045f4fadc7ccd83d09d0d5d25b11e86f8c9946 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 01:01:37 +0200 Subject: [PATCH 25/62] Add block meta field definition. --- schemas/rest-api/block.json | 4 ++++ .../routes/wp-v2-blocks-id-autosaves.json | 16 ++++++++++++++++ tests/data/rest-api/routes/wp-v2-blocks-id.json | 16 ++++++++++++++++ tests/data/rest-api/routes/wp-v2-blocks.json | 16 ++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/schemas/rest-api/block.json b/schemas/rest-api/block.json index ad0bad5..36d9011 100644 --- a/schemas/rest-api/block.json +++ b/schemas/rest-api/block.json @@ -156,6 +156,10 @@ "description": "The theme file to use to display the block.", "type": "string" }, + "meta": { + "description": "Meta fields.", + "type": "object" + }, "_links": { "$ref": "properties/object-links.json" } diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json index d204f39..acaa75b 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json @@ -126,6 +126,22 @@ }, "required": false }, + "meta": { + "description": "Meta fields.", + "type": "object", + "properties": { + "sync_status": { + "type": "string", + "description": "", + "default": "", + "enum": [ + "partial", + "unsynced" + ] + } + }, + "required": false + }, "template": { "description": "The theme file to use to display the post.", "type": "string", diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id.json b/tests/data/rest-api/routes/wp-v2-blocks-id.json index b6a8171..98bc9b3 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id.json @@ -142,6 +142,22 @@ }, "required": false }, + "meta": { + "description": "Meta fields.", + "type": "object", + "properties": { + "sync_status": { + "type": "string", + "description": "", + "default": "", + "enum": [ + "partial", + "unsynced" + ] + } + }, + "required": false + }, "template": { "description": "The theme file to use to display the post.", "type": "string", diff --git a/tests/data/rest-api/routes/wp-v2-blocks.json b/tests/data/rest-api/routes/wp-v2-blocks.json index 3c64c40..aafda9e 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks.json +++ b/tests/data/rest-api/routes/wp-v2-blocks.json @@ -263,6 +263,22 @@ }, "required": false }, + "meta": { + "description": "Meta fields.", + "type": "object", + "properties": { + "sync_status": { + "type": "string", + "description": "", + "default": "", + "enum": [ + "partial", + "unsynced" + ] + } + }, + "required": false + }, "template": { "description": "The theme file to use to display the post.", "type": "string", From 02e471434e529256a61361f7eb3f524cc9361d76 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 01:01:58 +0200 Subject: [PATCH 26/62] New post type label. --- schemas/properties/post-type-labels.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/schemas/properties/post-type-labels.json b/schemas/properties/post-type-labels.json index 1a684ca..0afa819 100644 --- a/schemas/properties/post-type-labels.json +++ b/schemas/properties/post-type-labels.json @@ -33,6 +33,7 @@ "item_published", "item_published_privately", "item_reverted_to_draft", + "item_trashed", "item_scheduled", "item_updated", "item_link", @@ -128,6 +129,9 @@ "item_reverted_to_draft": { "type": "string" }, + "item_trashed": { + "type": "string" + }, "item_scheduled": { "type": "string" }, From 9566bdf97f55a2166f0eb1e67401f765cdd7d394 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 01:04:32 +0200 Subject: [PATCH 27/62] Block related schema changes. --- schemas/block-template.json | 7 +++++++ schemas/block-type.json | 11 +++++++++++ schemas/rest-api/block-pattern.json | 11 +++++++++++ schemas/rest-api/block-type.json | 11 +++++++++++ 4 files changed, 40 insertions(+) diff --git a/schemas/block-template.json b/schemas/block-template.json index 6c60389..db68f25 100644 --- a/schemas/block-template.json +++ b/schemas/block-template.json @@ -20,6 +20,7 @@ "is_custom", "author", "post_types", + "modified", "area" ], "properties": { @@ -88,6 +89,12 @@ "string", "null" ] + }, + "modified": { + "type": [ + "string", + "null" + ] } }, "additionalProperties": false diff --git a/schemas/block-type.json b/schemas/block-type.json index a615390..b343062 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -101,6 +101,17 @@ "description": "Block variations.", "type": "array" }, + "selectors": { + "description": "Custom CSS selectors for theme.json style generation.", + "anyOf": [ + { + "$ref": "../schema.json#/definitions/EmptyArray" + }, + { + "type": "object" + } + ] + }, "supports": { "description": "Supported features.", "anyOf": [ diff --git a/schemas/rest-api/block-pattern.json b/schemas/rest-api/block-pattern.json index e4e8cc0..17c36df 100644 --- a/schemas/rest-api/block-pattern.json +++ b/schemas/rest-api/block-pattern.json @@ -57,6 +57,17 @@ "type": "string" } }, + "source": { + "description": "Where the pattern comes from e.g. core.", + "enum": [ + "core", + "plugin", + "theme", + "pattern-directory/core", + "pattern-directory/theme", + "pattern-directory/featured" + ] + }, "post_types": { "description": "An array of post types that the pattern is restricted to be used with.", "type": "array", diff --git a/schemas/rest-api/block-type.json b/schemas/rest-api/block-type.json index ace7d0e..4b056e7 100644 --- a/schemas/rest-api/block-type.json +++ b/schemas/rest-api/block-type.json @@ -101,6 +101,17 @@ "type": "string" } }, + "selectors": { + "description": "Custom CSS selectors for theme.json style generation.", + "anyOf": [ + { + "$ref": "../../schema.json#/definitions/EmptyArray" + }, + { + "type": "object" + } + ] + }, "supports": { "description": "Block supports.", "type": "object" From db1691adb3d038724e5fe1290bca45a352064055 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 01:04:59 +0200 Subject: [PATCH 28/62] New property for `WP_Query`. --- schemas/query.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/schemas/query.json b/schemas/query.json index b14e86c..25b35f5 100644 --- a/schemas/query.json +++ b/schemas/query.json @@ -14,6 +14,7 @@ "posts", "post_count", "current_post", + "before_loop", "in_the_loop", "current_comment", "found_posts", @@ -169,6 +170,10 @@ "description": "Index of the current item in the loop.", "type": "integer" }, + "before_loop": { + "description": "Whether the caller is before the loop.", + "type": "boolean" + }, "in_the_loop": { "description": "Whether the loop has started and the caller is in the loop.", "type": "boolean" From 527b16acdb9f03bfd48e0256ada34c9e4bc558e6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 7 Jul 2023 01:05:10 +0200 Subject: [PATCH 29/62] Updated interfaces. --- packages/wp-types/index.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 50c5507..7097222 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -300,6 +300,14 @@ export interface WP_Block_Type { * Block variations. */ variations?: unknown[]; + /** + * Custom CSS selectors for theme.json style generation. + */ + selectors?: + | EmptyArray + | { + [k: string]: unknown; + }; /** * Supported features. */ @@ -401,6 +409,7 @@ export interface WP_Block_Template { author: number | null; post_types: string[] | null; area: string | null; + modified: string | null; } /** * Core class used to organize comments as instantiated objects with defined members. @@ -924,6 +933,7 @@ export interface WP_Post_Type_Labels { item_published: string; item_published_privately: string; item_reverted_to_draft: string; + item_trashed: string; item_scheduled: string; item_updated: string; item_link: string; @@ -1041,6 +1051,10 @@ export interface WP_Query { * Index of the current item in the loop. */ current_post: number; + /** + * Whether the caller is before the loop. + */ + before_loop: boolean; /** * Whether the loop has started and the caller is in the loop. */ @@ -2281,6 +2295,12 @@ export interface WP_REST_API_Block { * The theme file to use to display the block. */ template?: string; + /** + * Meta fields. + */ + meta?: { + [k: string]: unknown; + }; _links: WP_REST_API_Object_Links; [k: string]: unknown; } @@ -2401,6 +2421,16 @@ export interface WP_REST_API_Block_Pattern { * Block types that the pattern is intended to be used with. */ block_types?: string[]; + /** + * Where the pattern comes from e.g. core. + */ + source?: + | "core" + | "plugin" + | "theme" + | "pattern-directory/core" + | "pattern-directory/theme" + | "pattern-directory/featured"; /** * An array of post types that the pattern is restricted to be used with. */ @@ -2462,6 +2492,14 @@ export interface WP_REST_API_Block_Type { * Context values inherited by blocks of this type. */ uses_context: string[]; + /** + * Custom CSS selectors for theme.json style generation. + */ + selectors?: + | EmptyArray + | { + [k: string]: unknown; + }; /** * Block supports. */ From 38a4a28df614e67bca23c1b22921e3c77363fd8b Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 8 Aug 2023 23:10:27 +0100 Subject: [PATCH 30/62] Update to WordPress 6.3. --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 63d4f87..65f7dff 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "require-dev": { "johnbillion/args": "1.7.0", "roots/wordpress-core-installer": "^1.0.0", - "roots/wordpress-full": "dev-main", + "roots/wordpress-full": "~6.3.0", "vlucas/phpdotenv": "^5", "wp-cli/core-command": "^2", "wp-cli/db-command": "^2", @@ -23,6 +23,7 @@ }, "config": { "allow-plugins": { + "composer/installers": true, "roots/wordpress-core-installer": true }, "preferred-install": "dist", From 7b2fd5ae2af115e66d982db7bc4ec23577cd1038 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 5 Oct 2023 23:16:34 +0200 Subject: [PATCH 31/62] Switch to using SQLite for the tests. --- .gitignore | 1 - CONTRIBUTING.md | 2 -- composer.json | 25 +++++++++++++++++++++---- tests/.env.dist | 4 ---- tests/wp-config.php | 21 +++++++-------------- 5 files changed, 28 insertions(+), 25 deletions(-) delete mode 100644 tests/.env.dist diff --git a/.gitignore b/.gitignore index 82776d3..ff2d5b5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,4 @@ /composer.lock /package-lock.json -/tests/.env /tests/hyper-schema/index.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 71a87b5..15c452e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,8 +25,6 @@ There is no fully automatic process to create these schemas. A schema for a PHP npm install -3. If you want to run the tests locally, check the MySQL database credentials in the `tests/.env` file and amend them as necessary. - ## Creating a REST API response schema The WordPress REST API response doesn't fully adhere to the JSON schema spec, so we need to tweak its output in order to generate a valid schema and to increase its specificity. diff --git a/composer.json b/composer.json index 65f7dff..d7a8a11 100644 --- a/composer.json +++ b/composer.json @@ -9,17 +9,29 @@ "homepage": "https://johnblackbourn.com/" } ], + "repositories": [ + { + "type": "composer", + "url": "https://wpackagist.org", + "only": [ + "wpackagist-plugin/*", + "wpackagist-theme/*" + ] + } + ], "require": { "php": "^7 || ^8" }, "require-dev": { + "ext-sqlite3": "*", + "ext-pdo_sqlite": "*", "johnbillion/args": "1.7.0", "roots/wordpress-core-installer": "^1.0.0", "roots/wordpress-full": "~6.3.0", - "vlucas/phpdotenv": "^5", "wp-cli/core-command": "^2", "wp-cli/db-command": "^2", - "wp-cli/language-command": "^2" + "wp-cli/language-command": "^2", + "wpackagist-plugin/sqlite-database-integration": "^2.1" }, "config": { "allow-plugins": { @@ -30,18 +42,23 @@ "sort-packages": true }, "extra": { + "installer-paths": { + "tests/wordpress/wp-content/plugins/{$name}/": [ + "wpackagist-plugin/sqlite-database-integration" + ] + }, "wordpress-install-dir": "tests/wordpress" }, "scripts": { "post-update-cmd": [ - "@php -r \"! file_exists( 'tests/.env' ) && copy( 'tests/.env.dist', 'tests/.env' );\"" + "@php -r \"file_exists( 'tests/wordpress/wp-content/db.php' ) || copy( 'tests/wordpress/wp-content/plugins/sqlite-database-integration/db.copy', 'tests/wordpress/wp-content/db.php' );\"" ], "test": [ "npm run validate", "npm run build-wp-types", "npm run test-wp-types", - "wp db reset --yes", + "rm -f tests/wordpress/wp-content/database/.ht.sqlite", "wp core multisite-install --url=example.org --title=Example --admin_user=admin --admin_email=admin@example.org --skip-email", "wp language core install de_DE it_IT ar he_IL", diff --git a/tests/.env.dist b/tests/.env.dist deleted file mode 100644 index 0c521df..0000000 --- a/tests/.env.dist +++ /dev/null @@ -1,4 +0,0 @@ -WP_TESTS_DB_NAME="wordpress_test" -WP_TESTS_DB_USER="root" -WP_TESTS_DB_PASS="" -WP_TESTS_DB_HOST="localhost" diff --git a/tests/wp-config.php b/tests/wp-config.php index 391829e..ff18fa7 100644 --- a/tests/wp-config.php +++ b/tests/wp-config.php @@ -1,15 +1,5 @@ load(); -} - // Configuration needed during testing: define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', true ); @@ -21,13 +11,16 @@ // WARNING WARNING WARNING! // These tests will DROP ALL TABLES in the database with the prefix named below. // DO NOT use a production database or one that is shared with something else. -define( 'DB_NAME', getenv( 'WP_TESTS_DB_NAME' ) ?: 'wordpress_test' ); -define( 'DB_USER', getenv( 'WP_TESTS_DB_USER' ) ?: 'root' ); -define( 'DB_PASSWORD', getenv( 'WP_TESTS_DB_PASS' ) ?: 'root' ); -define( 'DB_HOST', getenv( 'WP_TESTS_DB_HOST' ) ?: 'localhost' ); +define( 'DB_NAME', 'db.sqlite' ); +define( 'DB_USER', '' ); +define( 'DB_PASSWORD', '' ); +define( 'DB_HOST', '' ); define( 'DB_CHARSET', 'utf8' ); define( 'DB_COLLATE', '' ); +// SQLite config: +define( 'SQLITE_MAIN_FILE', __DIR__ . '/wordpress/plugins/sqlite-database-integration/load.php' ); + // Enable Multisite: define( 'WP_ALLOW_MULTISITE', true ); define( 'MULTISITE', true ); From a397822d30d863a1b1816babce6443cea794b20c Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 5 Oct 2023 23:20:59 +0200 Subject: [PATCH 32/62] Update the schemas for WordPress 6.3. --- packages/wp-types/index.ts | 9 ++++++--- schemas/rest-api/block.json | 18 +++++++++++++++++- .../routes/wp-v2-blocks-id-autosaves.json | 2 +- .../data/rest-api/routes/wp-v2-blocks-id.json | 2 +- tests/data/rest-api/routes/wp-v2-blocks.json | 2 +- .../routes/wp-v2-navigation-id-autosaves.json | 12 ++++++++---- .../rest-api/routes/wp-v2-navigation-id.json | 12 ++++++++---- .../data/rest-api/routes/wp-v2-navigation.json | 12 ++++++++---- 8 files changed, 50 insertions(+), 19 deletions(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 7097222..2598985 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -2291,6 +2291,7 @@ export interface WP_REST_API_Block { */ protected: boolean; }; + wp_pattern_sync_status: "" | "partial" | "unsynced"; /** * The theme file to use to display the block. */ @@ -2298,9 +2299,11 @@ export interface WP_REST_API_Block { /** * Meta fields. */ - meta?: { - [k: string]: unknown; - }; + meta?: + | EmptyArray + | { + [k: string]: unknown; + }; _links: WP_REST_API_Object_Links; [k: string]: unknown; } diff --git a/schemas/rest-api/block.json b/schemas/rest-api/block.json index 36d9011..489f9bf 100644 --- a/schemas/rest-api/block.json +++ b/schemas/rest-api/block.json @@ -17,6 +17,7 @@ "type", "title", "content", + "wp_pattern_sync_status", "_links" ], "properties": { @@ -152,13 +153,28 @@ }, "additionalProperties": false }, + "wp_pattern_sync_status": { + "type": "string", + "enum": [ + "", + "partial", + "unsynced" + ] + }, "template": { "description": "The theme file to use to display the block.", "type": "string" }, "meta": { "description": "Meta fields.", - "type": "object" + "anyOf": [ + { + "$ref": "../../schema.json#/definitions/EmptyArray" + }, + { + "type": "object" + } + ] }, "_links": { "$ref": "properties/object-links.json" diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json index acaa75b..e5d4040 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json @@ -130,7 +130,7 @@ "description": "Meta fields.", "type": "object", "properties": { - "sync_status": { + "wp_pattern_sync_status": { "type": "string", "description": "", "default": "", diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id.json b/tests/data/rest-api/routes/wp-v2-blocks-id.json index 98bc9b3..d96d8a0 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id.json @@ -146,7 +146,7 @@ "description": "Meta fields.", "type": "object", "properties": { - "sync_status": { + "wp_pattern_sync_status": { "type": "string", "description": "", "default": "", diff --git a/tests/data/rest-api/routes/wp-v2-blocks.json b/tests/data/rest-api/routes/wp-v2-blocks.json index aafda9e..b0351cb 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks.json +++ b/tests/data/rest-api/routes/wp-v2-blocks.json @@ -267,7 +267,7 @@ "description": "Meta fields.", "type": "object", "properties": { - "sync_status": { + "wp_pattern_sync_status": { "type": "string", "description": "", "default": "", diff --git a/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json index 25bc7ab..173984d 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json @@ -86,7 +86,8 @@ "description": "Title for the post, as it exists in the database.", "type": "string", "context": [ - "edit" + "edit", + "embed" ] }, "rendered": { @@ -110,7 +111,8 @@ "description": "Content for the post, as it exists in the database.", "type": "string", "context": [ - "edit" + "edit", + "embed" ] }, "rendered": { @@ -118,7 +120,8 @@ "type": "string", "context": [ "view", - "edit" + "edit", + "embed" ], "readonly": true }, @@ -126,7 +129,8 @@ "description": "Version of the content block format used by the post.", "type": "integer", "context": [ - "edit" + "edit", + "embed" ], "readonly": true }, diff --git a/tests/data/rest-api/routes/wp-v2-navigation-id.json b/tests/data/rest-api/routes/wp-v2-navigation-id.json index b652c47..7118e5c 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation-id.json +++ b/tests/data/rest-api/routes/wp-v2-navigation-id.json @@ -102,7 +102,8 @@ "description": "Title for the post, as it exists in the database.", "type": "string", "context": [ - "edit" + "edit", + "embed" ] }, "rendered": { @@ -126,7 +127,8 @@ "description": "Content for the post, as it exists in the database.", "type": "string", "context": [ - "edit" + "edit", + "embed" ] }, "rendered": { @@ -134,7 +136,8 @@ "type": "string", "context": [ "view", - "edit" + "edit", + "embed" ], "readonly": true }, @@ -142,7 +145,8 @@ "description": "Version of the content block format used by the post.", "type": "integer", "context": [ - "edit" + "edit", + "embed" ], "readonly": true }, diff --git a/tests/data/rest-api/routes/wp-v2-navigation.json b/tests/data/rest-api/routes/wp-v2-navigation.json index 632a23c..7f97a63 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation.json +++ b/tests/data/rest-api/routes/wp-v2-navigation.json @@ -223,7 +223,8 @@ "description": "Title for the post, as it exists in the database.", "type": "string", "context": [ - "edit" + "edit", + "embed" ] }, "rendered": { @@ -247,7 +248,8 @@ "description": "Content for the post, as it exists in the database.", "type": "string", "context": [ - "edit" + "edit", + "embed" ] }, "rendered": { @@ -255,7 +257,8 @@ "type": "string", "context": [ "view", - "edit" + "edit", + "embed" ], "readonly": true }, @@ -263,7 +266,8 @@ "description": "Version of the content block format used by the post.", "type": "integer", "context": [ - "edit" + "edit", + "embed" ], "readonly": true }, From 98a707c61491da0a3f2c559c92c6c9378491d969 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 5 Oct 2023 23:24:37 +0200 Subject: [PATCH 33/62] 3.63.0 --- package.json | 2 +- packages/wp-types/package.json | 2 +- packages/wp-types/readme.md | 7 ++----- readme.md | 7 ++----- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 2b9c7f3..56e7913 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-json-schemas", - "version": "3.62.4", + "version": "3.63.0", "description": "JSON schemas for WordPress PHP objects and REST API responses", "main": "schema.json", "files": [ diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index 76d3977..a88312c 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -1,6 +1,6 @@ { "name": "wp-types", - "version": "3.62.4", + "version": "3.63.0", "description": "TypeScript definitions of WordPress PHP objects and REST API responses.", "main": "", "types": "index.ts", diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 06270f7..6033ef1 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -172,16 +172,13 @@ 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. `62` for WordPress 6.2 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `63` for WordPress 6.3 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.62.0` - Schema version 3 for WordPress 6.2 -* `~3.61.0` - Schema version 3 for WordPress 6.1 +* `~3.63.0` - Schema version 3 for WordPress 6.3 * `~3.60.0` - Schema version 3 for WordPress 6.0 -* `~3.59.0` - Schema version 3 for WordPress 5.9 -* `~3.58.0` - Schema version 3 for WordPress 5.8 * `~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 00862e9..bd61998 100644 --- a/readme.md +++ b/readme.md @@ -177,16 +177,13 @@ 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. `62` for WordPress 6.2 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `63` for WordPress 6.3 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.62.0` - Schema version 3 for WordPress 6.2 -* `~3.61.0` - Schema version 3 for WordPress 6.1 +* `~3.63.0` - Schema version 3 for WordPress 6.3 * `~3.60.0` - Schema version 3 for WordPress 6.0 -* `~3.59.0` - Schema version 3 for WordPress 5.9 -* `~3.58.0` - Schema version 3 for WordPress 5.8 * `~3.57.0` - Schema version 3 for WordPress 5.7 * `^3.0.0` - Schema version 3 for the latest WordPress version From 23fa6f52fc07d68e5caffe8bc9d01793a23eecac Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:08:36 +0000 Subject: [PATCH 34/62] Fix some unnecessary `anyOf` properties. --- packages/wp-types/index.ts | 2 +- schemas/block-type.json | 10 +++++----- schemas/comment.json | 4 ++-- schemas/error-with-error.json | 4 ++-- schemas/error-without-error.json | 4 ++-- schemas/error.json | 7 ++----- schemas/post-type.json | 2 +- schemas/post.json | 14 +++++++------- schemas/properties/user-data.json | 2 +- schemas/query.json | 4 ++-- schemas/rest-api/application-password.json | 4 ++-- schemas/rest-api/attachment.json | 14 +++++++------- schemas/rest-api/block-type.json | 4 ++-- schemas/rest-api/block.json | 10 +++++----- schemas/rest-api/comment.json | 6 +++--- schemas/rest-api/post.json | 16 ++++++++-------- schemas/rest-api/revision.json | 8 ++++---- schemas/rest-api/settings.json | 4 ++-- schemas/rest-api/term.json | 2 +- schemas/rest-api/user.json | 4 ++-- schemas/site.json | 4 ++-- schemas/taxonomy.json | 2 +- schemas/term.json | 2 +- schemas/user.json | 2 +- 24 files changed, 66 insertions(+), 69 deletions(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 2598985..01cb7ed 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -499,7 +499,7 @@ export interface WP_Error { /** * Stores the list of data for error codes. */ - error_data: EmptyArray | WP_Error_Data; + error_data: WP_Error_Data; } /** * The messages for the errors contained within the error object. diff --git a/schemas/block-type.json b/schemas/block-type.json index b343062..f51c4af 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -103,7 +103,7 @@ }, "selectors": { "description": "Custom CSS selectors for theme.json style generation.", - "anyOf": [ + "oneOf": [ { "$ref": "../schema.json#/definitions/EmptyArray" }, @@ -114,7 +114,7 @@ }, "supports": { "description": "Supported features.", - "anyOf": [ + "oneOf": [ { "type": "object" }, @@ -125,7 +125,7 @@ }, "example": { "description": "Structured data for the block preview.", - "anyOf": [ + "oneOf": [ { "$ref": "../schema.json#/definitions/EmptyArray" }, @@ -139,7 +139,7 @@ }, "render_callback": { "description": "Block type render callback.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/callable.json" }, @@ -150,7 +150,7 @@ }, "attributes": { "description": "Block type attributes property schemas.", - "anyOf": [ + "oneOf": [ { "$ref": "../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/comment.json b/schemas/comment.json index 86eb074..a5ab28f 100644 --- a/schemas/comment.json +++ b/schemas/comment.json @@ -86,7 +86,7 @@ }, "comment_date": { "description": "Comment date in YYYY-MM-DD HH:MM:SS format.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } @@ -94,7 +94,7 @@ }, "comment_date_gmt": { "description": "Comment GMT date in YYYY-MM-DD HH::MM:SS format.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } diff --git a/schemas/error-with-error.json b/schemas/error-with-error.json index 394f074..0e979b0 100644 --- a/schemas/error-with-error.json +++ b/schemas/error-with-error.json @@ -12,7 +12,7 @@ "properties": { "errors": { "description": "Stores the list of errors.", - "anyOf": [ + "allOf": [ { "$ref": "properties/error-messages.json" } @@ -20,7 +20,7 @@ }, "error_data": { "description": "Stores the list of data for error codes.", - "anyOf": [ + "allOf": [ { "$ref": "properties/error-data.json" } diff --git a/schemas/error-without-error.json b/schemas/error-without-error.json index bde5d6b..a17fc3f 100644 --- a/schemas/error-without-error.json +++ b/schemas/error-without-error.json @@ -12,7 +12,7 @@ "properties": { "errors": { "description": "Stores the list of errors.", - "anyOf": [ + "allOf": [ { "$ref": "../schema.json#/definitions/EmptyArray" } @@ -20,7 +20,7 @@ }, "error_data": { "description": "Stores the list of data for error codes.", - "anyOf": [ + "allOf": [ { "$ref": "../schema.json#/definitions/EmptyArray" } diff --git a/schemas/error.json b/schemas/error.json index 608c8af..2b16330 100644 --- a/schemas/error.json +++ b/schemas/error.json @@ -12,7 +12,7 @@ "properties": { "errors": { "description": "Stores the list of errors.", - "anyOf": [ + "oneOf": [ { "$ref": "../schema.json#/definitions/EmptyArray" }, @@ -23,10 +23,7 @@ }, "error_data": { "description": "Stores the list of data for error codes.", - "anyOf": [ - { - "$ref": "../schema.json#/definitions/EmptyArray" - }, + "allOf": [ { "$ref": "properties/error-data.json" } diff --git a/schemas/post-type.json b/schemas/post-type.json index 5e5334b..35d588a 100644 --- a/schemas/post-type.json +++ b/schemas/post-type.json @@ -142,7 +142,7 @@ }, "register_meta_box_cb": { "description": "Provide a callback function that sets up the meta boxes for the edit form.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/callable.json" }, diff --git a/schemas/post.json b/schemas/post.json index 9fceb38..3b24b62 100644 --- a/schemas/post.json +++ b/schemas/post.json @@ -42,7 +42,7 @@ }, "post_date": { "description": "The post's local publication time.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } @@ -50,7 +50,7 @@ }, "post_date_gmt": { "description": "The post's GMT publication time.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } @@ -83,7 +83,7 @@ }, "comment_status": { "description": "Whether comments are allowed.", - "anyOf": [ + "allOf": [ { "$ref": "properties/post-comment-status-name.json" } @@ -91,7 +91,7 @@ }, "ping_status": { "description": "Whether pings are allowed.", - "anyOf": [ + "allOf": [ { "$ref": "properties/post-comment-status-name.json" } @@ -144,7 +144,7 @@ }, "post_modified": { "description": "The post's local modified time.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } @@ -152,7 +152,7 @@ }, "post_modified_gmt": { "description": "The post's GMT modified time.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } @@ -210,7 +210,7 @@ }, "filter": { "description": "Stores the post object's sanitization level.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/object-filter-context.json" }, diff --git a/schemas/properties/user-data.json b/schemas/properties/user-data.json index 67f8965..634e6ed 100644 --- a/schemas/properties/user-data.json +++ b/schemas/properties/user-data.json @@ -61,7 +61,7 @@ }, "user_registered": { "description": "The user's registration date.", - "anyOf": [ + "allOf": [ { "$ref": "date-time.json" } diff --git a/schemas/query.json b/schemas/query.json index 25b35f5..4c0cae3 100644 --- a/schemas/query.json +++ b/schemas/query.json @@ -141,7 +141,7 @@ }, "posts": { "description": "Array of post objects or post IDs.", - "anyOf": [ + "oneOf": [ { "type": "array", "items": { @@ -191,7 +191,7 @@ }, "comments": { "description": "The list of comments for current post.", - "anyOf": [ + "oneOf": [ { "type": "array", "items": { diff --git a/schemas/rest-api/application-password.json b/schemas/rest-api/application-password.json index 0a68c1b..19572e4 100644 --- a/schemas/rest-api/application-password.json +++ b/schemas/rest-api/application-password.json @@ -36,7 +36,7 @@ }, "created": { "description": "The GMT date the application password was created.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -45,7 +45,7 @@ }, "last_used": { "description": "The GMT date the application password was last used.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" }, diff --git a/schemas/rest-api/attachment.json b/schemas/rest-api/attachment.json index f3a2e4b..57306ad 100644 --- a/schemas/rest-api/attachment.json +++ b/schemas/rest-api/attachment.json @@ -34,7 +34,7 @@ "properties": { "date": { "description": "The date the attachment was published, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -42,7 +42,7 @@ }, "date_gmt": { "description": "The date the attachment was published, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -83,7 +83,7 @@ "modified": { "readOnly": true, "description": "The date the attachment was last modified, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -92,7 +92,7 @@ "modified_gmt": { "readOnly": true, "description": "The date the attachment was last modified, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -247,7 +247,7 @@ }, "comment_status": { "description": "Whether or not comments are open on the attachment.", - "anyOf": [ + "oneOf": [ { "$ref": "../properties/post-comment-status-name.json" } @@ -255,7 +255,7 @@ }, "ping_status": { "description": "Whether or not the attachment can be pinged.", - "anyOf": [ + "oneOf": [ { "$ref": "../properties/post-comment-status-name.json" } @@ -263,7 +263,7 @@ }, "meta": { "description": "Meta fields.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/rest-api/block-type.json b/schemas/rest-api/block-type.json index 4b056e7..2ea8770 100644 --- a/schemas/rest-api/block-type.json +++ b/schemas/rest-api/block-type.json @@ -103,7 +103,7 @@ }, "selectors": { "description": "Custom CSS selectors for theme.json style generation.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, @@ -273,7 +273,7 @@ }, "example": { "description": "Block example.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/rest-api/block.json b/schemas/rest-api/block.json index 489f9bf..b4511c8 100644 --- a/schemas/rest-api/block.json +++ b/schemas/rest-api/block.json @@ -23,7 +23,7 @@ "properties": { "date": { "description": "The date the block was published, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -31,7 +31,7 @@ }, "date_gmt": { "description": "The date the block was published, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -72,7 +72,7 @@ "modified": { "readOnly": true, "description": "The date the block was last modified, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -81,7 +81,7 @@ "modified_gmt": { "readOnly": true, "description": "The date the block was last modified, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -167,7 +167,7 @@ }, "meta": { "description": "Meta fields.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/rest-api/comment.json b/schemas/rest-api/comment.json index 6fceda7..80b3b17 100644 --- a/schemas/rest-api/comment.json +++ b/schemas/rest-api/comment.json @@ -110,7 +110,7 @@ }, "date": { "description": "The date the comment was published, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -118,7 +118,7 @@ }, "date_gmt": { "description": "The date the comment was published, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -203,7 +203,7 @@ }, "meta": { "description": "Meta fields.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/rest-api/post.json b/schemas/rest-api/post.json index 46b361f..010d2f3 100644 --- a/schemas/rest-api/post.json +++ b/schemas/rest-api/post.json @@ -27,7 +27,7 @@ "properties": { "date": { "description": "The date the post was published, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -35,7 +35,7 @@ }, "date_gmt": { "description": "The date the post was published, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -76,7 +76,7 @@ "modified": { "readOnly": true, "description": "The date the post was last modified, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -85,7 +85,7 @@ "modified_gmt": { "readOnly": true, "description": "The date the post was last modified, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -240,7 +240,7 @@ }, "comment_status": { "description": "Whether or not comments are open on the post.", - "anyOf": [ + "oneOf": [ { "$ref": "../properties/post-comment-status-name.json" } @@ -248,7 +248,7 @@ }, "ping_status": { "description": "Whether or not the post can be pinged.", - "anyOf": [ + "oneOf": [ { "$ref": "../properties/post-comment-status-name.json" } @@ -256,7 +256,7 @@ }, "format": { "description": "The format for the post.", - "anyOf": [ + "oneOf": [ { "$ref": "../properties/post-format-name.json" } @@ -264,7 +264,7 @@ }, "meta": { "description": "Meta fields.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/rest-api/revision.json b/schemas/rest-api/revision.json index 426fced..857dfd2 100644 --- a/schemas/rest-api/revision.json +++ b/schemas/rest-api/revision.json @@ -29,7 +29,7 @@ }, "date": { "description": "The date the revision was published, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -37,7 +37,7 @@ }, "date_gmt": { "description": "The date the revision was published, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -69,7 +69,7 @@ }, "modified": { "description": "The date the revision was last modified, in the site's timezone.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } @@ -77,7 +77,7 @@ }, "modified_gmt": { "description": "The date the revision was last modified, as GMT.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time.json" } diff --git a/schemas/rest-api/settings.json b/schemas/rest-api/settings.json index 02b795c..1f0966a 100644 --- a/schemas/rest-api/settings.json +++ b/schemas/rest-api/settings.json @@ -78,7 +78,7 @@ }, "default_ping_status": { "description": "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.", - "anyOf": [ + "oneOf": [ { "$ref": "../properties/post-comment-status-name.json" } @@ -86,7 +86,7 @@ }, "default_comment_status": { "description": "Allow people to submit comments on new posts.", - "anyOf": [ + "oneOf": [ { "$ref": "../properties/post-comment-status-name.json" } diff --git a/schemas/rest-api/term.json b/schemas/rest-api/term.json index 8a3e325..8fb6098 100644 --- a/schemas/rest-api/term.json +++ b/schemas/rest-api/term.json @@ -67,7 +67,7 @@ }, "meta": { "description": "Meta fields.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/rest-api/user.json b/schemas/rest-api/user.json index 88a6742..ae5ecf3 100644 --- a/schemas/rest-api/user.json +++ b/schemas/rest-api/user.json @@ -92,7 +92,7 @@ "registered_date": { "readOnly": true, "description": "Registration date for the user in UTC. Only present when using the 'edit' context.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/date-time-utc.json" } @@ -164,7 +164,7 @@ }, "meta": { "description": "Meta fields.", - "anyOf": [ + "oneOf": [ { "$ref": "../../schema.json#/definitions/EmptyArray" }, diff --git a/schemas/site.json b/schemas/site.json index 30fe4dc..dcd8f47 100644 --- a/schemas/site.json +++ b/schemas/site.json @@ -40,7 +40,7 @@ }, "registered": { "description": "The date on which the site was created or registered.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } @@ -48,7 +48,7 @@ }, "last_updated": { "description": "The date and time on which site settings were last updated.", - "anyOf": [ + "allOf": [ { "$ref": "properties/date-time.json" } diff --git a/schemas/taxonomy.json b/schemas/taxonomy.json index a334097..e30d10f 100644 --- a/schemas/taxonomy.json +++ b/schemas/taxonomy.json @@ -102,7 +102,7 @@ }, "meta_box_cb": { "description": "The callback function for the meta box display.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/callable.json" }, diff --git a/schemas/term.json b/schemas/term.json index e491c88..5b25721 100644 --- a/schemas/term.json +++ b/schemas/term.json @@ -116,7 +116,7 @@ }, "filter": { "description": "Stores the term object's sanitization level.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/object-filter-context.json" }, diff --git a/schemas/user.json b/schemas/user.json index 8162caa..577e24f 100644 --- a/schemas/user.json +++ b/schemas/user.json @@ -49,7 +49,7 @@ }, "filter": { "description": "The filter context applied to user data fields.", - "anyOf": [ + "oneOf": [ { "$ref": "properties/object-filter-context.json" }, From 1867e245cf928d443bb77a32a7f2fd82c724c993 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:11:37 +0000 Subject: [PATCH 35/62] Update to WordPress 6.4. --- composer.json | 2 +- packages/wp-types/readme.md | 6 +++--- readme.md | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index d7a8a11..0569ec6 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.3.0", + "roots/wordpress-full": "~6.4.0", "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 6033ef1..4e149c8 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.3. +The definitions were last updated for WordPress 6.4. ## What's included? @@ -172,12 +172,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. `63` for WordPress 6.3 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `63` for WordPress 6.4 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.63.0` - Schema version 3 for WordPress 6.3 +* `~3.63.0` - Schema version 3 for WordPress 6.4 * `~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 bd61998..81796cd 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.3. +The schemas were last updated for WordPress 6.4. ## What's included? @@ -177,12 +177,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. `63` for WordPress 6.3 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `63` for WordPress 6.4 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.63.0` - Schema version 3 for WordPress 6.3 +* `~3.63.0` - Schema version 3 for WordPress 6.4 * `~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 742796d7356b3ca3dae119c1de29d4f785bb4c4f Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:12:35 +0000 Subject: [PATCH 36/62] REST API route changes. --- tests/data/rest-api/routes/routes.json | 16 ++++++++-------- .../wp-v2-template-parts-id-autosaves.json | 2 +- ...wp-v2-template-parts-parent-autosaves-id.json | 2 +- ...wp-v2-template-parts-parent-revisions-id.json | 2 +- .../wp-v2-template-parts-parent-revisions.json | 2 +- .../routes/wp-v2-templates-id-autosaves.json | 2 +- .../wp-v2-templates-parent-autosaves-id.json | 2 +- .../wp-v2-templates-parent-revisions-id.json | 2 +- .../routes/wp-v2-templates-parent-revisions.json | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/data/rest-api/routes/routes.json b/tests/data/rest-api/routes/routes.json index 7a3459e..0ab7f7e 100644 --- a/tests/data/rest-api/routes/routes.json +++ b/tests/data/rest-api/routes/routes.json @@ -66,17 +66,17 @@ "/wp/v2/taxonomies/(?P[\\w-]+)", "/wp/v2/template-parts", "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)", - "/wp/v2/template-parts/(?P[\\d]+)/autosaves", - "/wp/v2/template-parts/(?P[\\d]+)/autosaves/(?P[\\d]+)", - "/wp/v2/template-parts/(?P[\\d]+)/revisions", - "/wp/v2/template-parts/(?P[\\d]+)/revisions/(?P[\\d]+)", + "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves", + "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves/(?P[\\d]+)", + "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions", + "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions/(?P[\\d]+)", "/wp/v2/template-parts/lookup", "/wp/v2/templates", "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)", - "/wp/v2/templates/(?P[\\d]+)/autosaves", - "/wp/v2/templates/(?P[\\d]+)/autosaves/(?P[\\d]+)", - "/wp/v2/templates/(?P[\\d]+)/revisions", - "/wp/v2/templates/(?P[\\d]+)/revisions/(?P[\\d]+)", + "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves", + "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves/(?P[\\d]+)", + "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions", + "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions/(?P[\\d]+)", "/wp/v2/templates/lookup", "/wp/v2/themes", "/wp/v2/themes/(?P[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)", diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json index c8b8e8b..9218ded 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json @@ -140,5 +140,5 @@ } } ], - "route": "/wp/v2/template-parts/(?P[\\d]+)/autosaves" + "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json index 5e2c2a9..c6bbce8 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json @@ -33,5 +33,5 @@ } } ], - "route": "/wp/v2/template-parts/(?P[\\d]+)/autosaves/(?P[\\d]+)" + "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json index 9f20c4d..391aedc 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json @@ -57,5 +57,5 @@ } } ], - "route": "/wp/v2/template-parts/(?P[\\d]+)/revisions/(?P[\\d]+)" + "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json index 62a5ce9..1ee2acd 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json @@ -95,5 +95,5 @@ } } ], - "route": "/wp/v2/template-parts/(?P[\\d]+)/revisions" + "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json index 64e00d1..b8f02e7 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json @@ -135,5 +135,5 @@ } } ], - "route": "/wp/v2/templates/(?P[\\d]+)/autosaves" + "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json index 7e677b0..1d81266 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json @@ -33,5 +33,5 @@ } } ], - "route": "/wp/v2/templates/(?P[\\d]+)/autosaves/(?P[\\d]+)" + "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json index a27aae8..1680761 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json @@ -57,5 +57,5 @@ } } ], - "route": "/wp/v2/templates/(?P[\\d]+)/revisions/(?P[\\d]+)" + "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json index 0ea397e..e2446e1 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json @@ -95,5 +95,5 @@ } } ], - "route": "/wp/v2/templates/(?P[\\d]+)/revisions" + "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions" } \ No newline at end of file From 9cddd14c01f26a51cc0c44397eb8008c2b86119c Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:14:21 +0000 Subject: [PATCH 37/62] The callable type allows anything. --- schemas/block-type.json | 2 +- schemas/post-type.json | 2 +- schemas/taxonomy.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schemas/block-type.json b/schemas/block-type.json index f51c4af..806e105 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -139,7 +139,7 @@ }, "render_callback": { "description": "Block type render callback.", - "oneOf": [ + "anyOf": [ { "$ref": "properties/callable.json" }, diff --git a/schemas/post-type.json b/schemas/post-type.json index 35d588a..5e5334b 100644 --- a/schemas/post-type.json +++ b/schemas/post-type.json @@ -142,7 +142,7 @@ }, "register_meta_box_cb": { "description": "Provide a callback function that sets up the meta boxes for the edit form.", - "oneOf": [ + "anyOf": [ { "$ref": "properties/callable.json" }, diff --git a/schemas/taxonomy.json b/schemas/taxonomy.json index e30d10f..a334097 100644 --- a/schemas/taxonomy.json +++ b/schemas/taxonomy.json @@ -102,7 +102,7 @@ }, "meta_box_cb": { "description": "The callback function for the meta box display.", - "oneOf": [ + "anyOf": [ { "$ref": "properties/callable.json" }, From 5a663d7d2c51f7cf4d178d4016ca4c6eef75ba79 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:20:15 +0000 Subject: [PATCH 38/62] New properties for post REST API endpoints. --- packages/wp-types/index.ts | 24 +++++++++++++++++++++ schemas/post-type.json | 43 +++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 01cb7ed..5b61a7b 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -894,12 +894,36 @@ export interface WP_Post_Type { * The controller for this post type's REST API endpoints. */ rest_controller_class: string | false; + /** + * The controller for this post type's revisions REST API endpoints. + */ + revisions_rest_controller_class: string | false; + /** + * The controller for this post type's autosave REST API endpoints. + */ + autosave_rest_controller_class: string | false; /** * The controller instance for this post type's REST API endpoints. */ rest_controller: { [k: string]: unknown; }; + /** + * The controller instance for this post type's revisions REST API endpoints. + */ + revisions_rest_controller: { + [k: string]: unknown; + }; + /** + * The controller instance for this post type's autosave REST API endpoints. + */ + autosave_rest_controller: { + [k: string]: unknown; + }; + /** + * A flag to register the post type REST API controller after its associated autosave / revisions controllers, instead of before. Registration order affects route matching priority. + */ + late_route_registration: boolean; } /** * Post type labels. diff --git a/schemas/post-type.json b/schemas/post-type.json index 5e5334b..8581194 100644 --- a/schemas/post-type.json +++ b/schemas/post-type.json @@ -38,7 +38,12 @@ "rest_base", "rest_namespace", "rest_controller_class", - "rest_controller" + "revisions_rest_controller_class", + "autosave_rest_controller_class", + "rest_controller", + "revisions_rest_controller", + "autosave_rest_controller", + "late_route_registration" ], "properties": { "name": { @@ -279,8 +284,44 @@ } ] }, + "revisions_rest_controller_class": { + "description": "The controller for this post type's revisions REST API endpoints.", + "oneOf": [ + { + "type": "string" + }, + { + "enum": [ + false + ] + } + ] + }, + "autosave_rest_controller_class": { + "description": "The controller for this post type's autosave REST API endpoints.", + "oneOf": [ + { + "type": "string" + }, + { + "enum": [ + false + ] + } + ] + }, "rest_controller": { "description": "The controller instance for this post type's REST API endpoints." + }, + "revisions_rest_controller": { + "description": "The controller instance for this post type's revisions REST API endpoints." + }, + "autosave_rest_controller": { + "description": "The controller instance for this post type's autosave REST API endpoints." + }, + "late_route_registration": { + "description": "A flag to register the post type REST API controller after its associated autosave / revisions controllers, instead of before. Registration order affects route matching priority.", + "type": "boolean" } }, "additionalProperties": false From 6b7cd519cbeef093a435a015ac3946afdfaf48d4 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:45:20 +0000 Subject: [PATCH 39/62] Updated REST API schemas for 6.4. --- packages/wp-types/index.ts | 30 ++++++ schemas/block-type.json | 15 +++ schemas/query.json | 2 +- schemas/rest-api/block-type.json | 15 +++ schemas/rest-api/block.json | 3 + schemas/rest-api/revision.json | 12 +++ .../routes/wp-v2-blocks-id-autosaves.json | 8 ++ .../data/rest-api/routes/wp-v2-blocks-id.json | 8 ++ tests/data/rest-api/routes/wp-v2-blocks.json | 94 +++++++++++++++++++ 9 files changed, 186 insertions(+), 1 deletion(-) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 5b61a7b..d974d84 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -300,6 +300,14 @@ export interface WP_Block_Type { * Block variations. */ variations?: unknown[]; + /** + * Block hooks for this block type. + */ + block_hooks: + | EmptyArray + | { + [k: string]: string; + }; /** * Custom CSS selectors for theme.json style generation. */ @@ -2316,6 +2324,12 @@ export interface WP_REST_API_Block { protected: boolean; }; wp_pattern_sync_status: "" | "partial" | "unsynced"; + /** + * Pattern categories. + */ + wp_pattern_category?: { + [k: string]: unknown; + }; /** * The theme file to use to display the block. */ @@ -2609,6 +2623,14 @@ export interface WP_REST_API_Block_Type { variations: { [k: string]: unknown; }[]; + /** + * Block hooks for this block type. + */ + block_hooks: + | EmptyArray + | { + [k: string]: string; + }; /** * Public text domain. */ @@ -2755,6 +2777,14 @@ export interface WP_REST_API_Revision { rendered: string; [k: string]: unknown; }; + /** + * Meta fields. + */ + meta: + | EmptyArray + | { + [k: string]: unknown; + }; _links: WP_REST_API_Object_Links; [k: string]: unknown; } diff --git a/schemas/block-type.json b/schemas/block-type.json index 806e105..7366a15 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -21,6 +21,7 @@ "render_callback", "attributes", "uses_context", + "block_hooks", "provides_context", "editor_script_handles", "script_handles", @@ -101,6 +102,20 @@ "description": "Block variations.", "type": "array" }, + "block_hooks": { + "description": "Block hooks for this block type.", + "oneOf": [ + { + "$ref": "../schema.json#/definitions/EmptyArray" + }, + { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + ] + }, "selectors": { "description": "Custom CSS selectors for theme.json style generation.", "oneOf": [ diff --git a/schemas/query.json b/schemas/query.json index 4c0cae3..29d6dc9 100644 --- a/schemas/query.json +++ b/schemas/query.json @@ -141,7 +141,7 @@ }, "posts": { "description": "Array of post objects or post IDs.", - "oneOf": [ + "anyOf": [ { "type": "array", "items": { diff --git a/schemas/rest-api/block-type.json b/schemas/rest-api/block-type.json index 2ea8770..8433730 100644 --- a/schemas/rest-api/block-type.json +++ b/schemas/rest-api/block-type.json @@ -24,6 +24,7 @@ "style", "styles", "variations", + "block_hooks", "textdomain", "parent", "keywords", @@ -247,6 +248,20 @@ "type": "object" } }, + "block_hooks": { + "description": "Block hooks for this block type.", + "oneOf": [ + { + "$ref": "../../schema.json#/definitions/EmptyArray" + }, + { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + ] + }, "textdomain": { "description": "Public text domain.", "type": [ diff --git a/schemas/rest-api/block.json b/schemas/rest-api/block.json index b4511c8..67bc176 100644 --- a/schemas/rest-api/block.json +++ b/schemas/rest-api/block.json @@ -161,6 +161,9 @@ "unsynced" ] }, + "wp_pattern_category": { + "description": "Pattern categories." + }, "template": { "description": "The theme file to use to display the block.", "type": "string" diff --git a/schemas/rest-api/revision.json b/schemas/rest-api/revision.json index 857dfd2..f745bb9 100644 --- a/schemas/rest-api/revision.json +++ b/schemas/rest-api/revision.json @@ -16,6 +16,7 @@ "slug", "title", "content", + "meta", "_links" ], "properties": { @@ -157,6 +158,17 @@ } } }, + "meta": { + "description": "Meta fields.", + "oneOf": [ + { + "$ref": "../../schema.json#/definitions/EmptyArray" + }, + { + "type": "object" + } + ] + }, "_links": { "$ref": "properties/object-links.json" } diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json index e5d4040..4d71da4 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json @@ -146,6 +146,14 @@ "description": "The theme file to use to display the post.", "type": "string", "required": false + }, + "wp_pattern_category": { + "description": "The terms assigned to the post in the wp_pattern_category taxonomy.", + "type": "array", + "items": { + "type": "integer" + }, + "required": false } } } diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id.json b/tests/data/rest-api/routes/wp-v2-blocks-id.json index d96d8a0..9648c36 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id.json @@ -162,6 +162,14 @@ "description": "The theme file to use to display the post.", "type": "string", "required": false + }, + "wp_pattern_category": { + "description": "The terms assigned to the post in the wp_pattern_category taxonomy.", + "type": "array", + "items": { + "type": "integer" + }, + "required": false } } }, diff --git a/tests/data/rest-api/routes/wp-v2-blocks.json b/tests/data/rest-api/routes/wp-v2-blocks.json index b0351cb..c14442b 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks.json +++ b/tests/data/rest-api/routes/wp-v2-blocks.json @@ -164,6 +164,92 @@ "type": "string" }, "required": false + }, + "tax_relation": { + "description": "Limit result set based on relationship between multiple taxonomies.", + "type": "string", + "enum": [ + "AND", + "OR" + ], + "required": false + }, + "wp_pattern_category": { + "description": "Limit result set to items with specific terms assigned in the wp_pattern_category taxonomy.", + "type": [ + "object", + "array" + ], + "oneOf": [ + { + "title": "Term ID List", + "description": "Match terms with the listed IDs.", + "type": "array", + "items": { + "type": "integer" + } + }, + { + "title": "Term ID Taxonomy Query", + "description": "Perform an advanced term query.", + "type": "object", + "properties": { + "terms": { + "description": "Term IDs.", + "type": "array", + "items": { + "type": "integer" + }, + "default": [] + }, + "operator": { + "description": "Whether items must be assigned all or any of the specified terms.", + "type": "string", + "enum": [ + "AND", + "OR" + ], + "default": "OR" + } + }, + "additionalProperties": false + } + ], + "required": false + }, + "wp_pattern_category_exclude": { + "description": "Limit result set to items except those with specific terms assigned in the wp_pattern_category taxonomy.", + "type": [ + "object", + "array" + ], + "oneOf": [ + { + "title": "Term ID List", + "description": "Match terms with the listed IDs.", + "type": "array", + "items": { + "type": "integer" + } + }, + { + "title": "Term ID Taxonomy Query", + "description": "Perform an advanced term query.", + "type": "object", + "properties": { + "terms": { + "description": "Term IDs.", + "type": "array", + "items": { + "type": "integer" + }, + "default": [] + } + }, + "additionalProperties": false + } + ], + "required": false } } }, @@ -283,6 +369,14 @@ "description": "The theme file to use to display the post.", "type": "string", "required": false + }, + "wp_pattern_category": { + "description": "The terms assigned to the post in the wp_pattern_category taxonomy.", + "type": "array", + "items": { + "type": "integer" + }, + "required": false } } } From a8a4b69cf09d2676a67189577610fde995c31038 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:47:35 +0000 Subject: [PATCH 40/62] New REST API endpoints in 6.4. --- packages/wp-types/readme.md | 2 + readme.md | 2 + tests/data/rest-api/routes/routes.json | 4 +- .../routes/wp-v2-wp-pattern-category-id.json | 98 +++++++++++ .../routes/wp-v2-wp-pattern-category.json | 158 ++++++++++++++++++ 5 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json create mode 100644 tests/data/rest-api/routes/wp-v2-wp-pattern-category.json diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 4e149c8..1425982 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -128,6 +128,8 @@ Route | Schema /wp/v2/widget-types/{id}/render | Todo /wp/v2/widgets | Todo /wp/v2/widgets/{id} | Todo +/wp/v2/wp_pattern_category | Todo +/wp/v2/wp_pattern_category/{id} | Todo Any enveloped REST API response | `WP_REST_API_Envelope` Any REST API error | `WP_REST_API_Error` diff --git a/readme.md b/readme.md index 81796cd..3d52f68 100644 --- a/readme.md +++ b/readme.md @@ -132,6 +132,8 @@ Route | Schema /wp/v2/widget-types/{id}/render | Todo /wp/v2/widgets | Todo /wp/v2/widgets/{id} | Todo +/wp/v2/wp_pattern_category | Todo +/wp/v2/wp_pattern_category/{id} | Todo Any REST API error | `WP_REST_API_Error` The REST API schemas use JSON Hyper-Schema. diff --git a/tests/data/rest-api/routes/routes.json b/tests/data/rest-api/routes/routes.json index 0ab7f7e..df19d17 100644 --- a/tests/data/rest-api/routes/routes.json +++ b/tests/data/rest-api/routes/routes.json @@ -93,5 +93,7 @@ "/wp/v2/widget-types/(?P[a-zA-Z0-9_-]+)/encode", "/wp/v2/widget-types/(?P[a-zA-Z0-9_-]+)/render", "/wp/v2/widgets", - "/wp/v2/widgets/(?P[\\w\\-]+)" + "/wp/v2/widgets/(?P[\\w\\-]+)", + "/wp/v2/wp_pattern_category", + "/wp/v2/wp_pattern_category/(?P[\\d]+)" ] \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json b/tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json new file mode 100644 index 0000000..6de3f87 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json @@ -0,0 +1,98 @@ +{ + "namespace": "wp/v2", + "methods": [ + "GET", + "POST", + "PUT", + "PATCH", + "DELETE" + ], + "endpoints": [ + { + "methods": [ + "GET" + ], + "allow_batch": { + "v1": true + }, + "args": { + "id": { + "description": "Unique identifier for the term.", + "type": "integer", + "required": false + }, + "context": { + "description": "Scope under which the request is made; determines fields present in response.", + "type": "string", + "enum": [ + "view", + "embed", + "edit" + ], + "default": "view", + "required": false + } + } + }, + { + "methods": [ + "POST", + "PUT", + "PATCH" + ], + "allow_batch": { + "v1": true + }, + "args": { + "id": { + "description": "Unique identifier for the term.", + "type": "integer", + "required": false + }, + "description": { + "description": "HTML description of the term.", + "type": "string", + "required": false + }, + "name": { + "description": "HTML title for the term.", + "type": "string", + "required": false + }, + "slug": { + "description": "An alphanumeric identifier for the term unique to its type.", + "type": "string", + "required": false + }, + "meta": { + "description": "Meta fields.", + "type": "object", + "properties": [], + "required": false + } + } + }, + { + "methods": [ + "DELETE" + ], + "allow_batch": { + "v1": true + }, + "args": { + "id": { + "description": "Unique identifier for the term.", + "type": "integer", + "required": false + }, + "force": { + "type": "boolean", + "default": false, + "description": "Required to be true, as terms do not support trashing.", + "required": false + } + } + } + ], + "route": "/wp/v2/wp_pattern_category/(?P[\\d]+)" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-wp-pattern-category.json b/tests/data/rest-api/routes/wp-v2-wp-pattern-category.json new file mode 100644 index 0000000..a2affe8 --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-wp-pattern-category.json @@ -0,0 +1,158 @@ +{ + "namespace": "wp/v2", + "methods": [ + "GET", + "POST" + ], + "endpoints": [ + { + "methods": [ + "GET" + ], + "allow_batch": { + "v1": true + }, + "args": { + "context": { + "description": "Scope under which the request is made; determines fields present in response.", + "type": "string", + "enum": [ + "view", + "embed", + "edit" + ], + "default": "view", + "required": false + }, + "page": { + "description": "Current page of the collection.", + "type": "integer", + "default": 1, + "minimum": 1, + "required": false + }, + "per_page": { + "description": "Maximum number of items to be returned in result set.", + "type": "integer", + "default": 10, + "minimum": 1, + "maximum": 100, + "required": false + }, + "search": { + "description": "Limit results to those matching a string.", + "type": "string", + "required": false + }, + "exclude": { + "description": "Ensure result set excludes specific IDs.", + "type": "array", + "items": { + "type": "integer" + }, + "default": [], + "required": false + }, + "include": { + "description": "Limit result set to specific IDs.", + "type": "array", + "items": { + "type": "integer" + }, + "default": [], + "required": false + }, + "offset": { + "description": "Offset the result set by a specific number of items.", + "type": "integer", + "required": false + }, + "order": { + "description": "Order sort attribute ascending or descending.", + "type": "string", + "default": "asc", + "enum": [ + "asc", + "desc" + ], + "required": false + }, + "orderby": { + "description": "Sort collection by term attribute.", + "type": "string", + "default": "name", + "enum": [ + "id", + "include", + "name", + "slug", + "include_slugs", + "term_group", + "description", + "count" + ], + "required": false + }, + "hide_empty": { + "description": "Whether to hide terms not assigned to any posts.", + "type": "boolean", + "default": false, + "required": false + }, + "post": { + "description": "Limit result set to terms assigned to a specific post.", + "type": "integer", + "default": null, + "required": false + }, + "slug": { + "description": "Limit result set to terms with one or more specific slugs.", + "type": "array", + "items": { + "type": "string" + }, + "required": false + } + } + }, + { + "methods": [ + "POST" + ], + "allow_batch": { + "v1": true + }, + "args": { + "description": { + "description": "HTML description of the term.", + "type": "string", + "required": false + }, + "name": { + "description": "HTML title for the term.", + "type": "string", + "required": true + }, + "slug": { + "description": "An alphanumeric identifier for the term unique to its type.", + "type": "string", + "required": false + }, + "meta": { + "description": "Meta fields.", + "type": "object", + "properties": [], + "required": false + } + } + } + ], + "_links": { + "self": [ + { + "href": "http://example.org/wp-json/wp/v2/wp_pattern_category" + } + ] + }, + "route": "/wp/v2/wp_pattern_category" +} \ No newline at end of file From 86b6583d3fcf0d672b16e7935518c3e57cf313cf Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:48:17 +0000 Subject: [PATCH 41/62] Updated REST API arguments for 6.4. --- .../routes/wp-v2-template-parts-id-autosaves.json | 12 ++++++------ .../wp-v2-template-parts-parent-autosaves-id.json | 4 ++-- .../wp-v2-template-parts-parent-revisions-id.json | 8 ++++---- .../wp-v2-template-parts-parent-revisions.json | 4 ++-- .../routes/wp-v2-templates-id-autosaves.json | 12 ++++++------ .../routes/wp-v2-templates-parent-autosaves-id.json | 4 ++-- .../routes/wp-v2-templates-parent-revisions-id.json | 8 ++++---- .../routes/wp-v2-templates-parent-revisions.json | 4 ++-- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json index 9218ded..028d61e 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json @@ -10,9 +10,9 @@ "GET" ], "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", + "id": { + "description": "The id of a template", + "type": "string", "required": false }, "context": { @@ -33,9 +33,9 @@ "POST" ], "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", + "id": { + "description": "The id of a template", + "type": "string", "required": false }, "slug": { diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json index c6bbce8..4bfa07c 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json @@ -10,8 +10,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "id": { diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json index 391aedc..6c1c090 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json @@ -11,8 +11,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "id": { @@ -39,8 +39,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "id": { diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json index 1ee2acd..9ad956e 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json @@ -10,8 +10,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "context": { diff --git a/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json index b8f02e7..7cba606 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json @@ -10,9 +10,9 @@ "GET" ], "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", + "id": { + "description": "The id of a template", + "type": "string", "required": false }, "context": { @@ -33,9 +33,9 @@ "POST" ], "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", + "id": { + "description": "The id of a template", + "type": "string", "required": false }, "slug": { diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json index 1d81266..4f1be42 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json @@ -10,8 +10,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "id": { diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json index 1680761..69aa509 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json @@ -11,8 +11,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "id": { @@ -39,8 +39,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "id": { diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json index e2446e1..14e573a 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json @@ -10,8 +10,8 @@ ], "args": { "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", + "description": "The id of a template", + "type": "string", "required": false }, "context": { From 5fe7183ef4eddb04a6943364342af9f38b4bb18d Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 8 Nov 2023 00:48:44 +0000 Subject: [PATCH 42/62] 3.64.0 --- package.json | 2 +- packages/wp-types/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 56e7913..8e3b4d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-json-schemas", - "version": "3.63.0", + "version": "3.64.0", "description": "JSON schemas for WordPress PHP objects and REST API responses", "main": "schema.json", "files": [ diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index a88312c..9b2ae37 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -1,6 +1,6 @@ { "name": "wp-types", - "version": "3.63.0", + "version": "3.64.0", "description": "TypeScript definitions of WordPress PHP objects and REST API responses.", "main": "", "types": "index.ts", From 1064beb716e72eba13774112b74d3597133774f0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 8 Mar 2024 01:24:09 +0000 Subject: [PATCH 43/62] Docs. --- packages/wp-types/readme.md | 4 ++-- readme.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 1425982..c5e67a6 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -174,12 +174,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. `63` for WordPress 6.4 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `64` for WordPress 6.4 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.63.0` - Schema version 3 for WordPress 6.4 +* `~3.64.0` - Schema version 3 for WordPress 6.4 * `~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 3d52f68..23adcf2 100644 --- a/readme.md +++ b/readme.md @@ -179,12 +179,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. `63` for WordPress 6.4 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `64` for WordPress 6.4 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.63.0` - Schema version 3 for WordPress 6.4 +* `~3.64.0` - Schema version 3 for WordPress 6.4 * `~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 c117d382bbc3591518cf3ef968e45cc1eddd7d58 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 9 Mar 2024 13:21:11 +0000 Subject: [PATCH 44/62] We only need the route data in these files. --- .../routes/wp-v2-block-directory-search.json | 50 -- .../wp-v2-block-patterns-categories.json | 19 - .../routes/wp-v2-block-patterns-patterns.json | 19 - .../routes/wp-v2-block-renderer-name.json | 40 -- .../wp-v2-block-types-namespace-name.json | 34 - .../routes/wp-v2-block-types-namespace.json | 29 - .../rest-api/routes/wp-v2-block-types.json | 36 -- .../routes/wp-v2-blocks-id-autosaves.json | 159 ----- .../data/rest-api/routes/wp-v2-blocks-id.json | 196 ------ .../wp-v2-blocks-parent-autosaves-id.json | 34 - .../wp-v2-blocks-parent-revisions-id.json | 58 -- .../routes/wp-v2-blocks-parent-revisions.json | 96 --- tests/data/rest-api/routes/wp-v2-blocks.json | 389 ----------- .../rest-api/routes/wp-v2-categories-id.json | 100 --- .../rest-api/routes/wp-v2-categories.json | 160 ----- .../rest-api/routes/wp-v2-comments-id.json | 165 ----- .../data/rest-api/routes/wp-v2-comments.json | 278 -------- .../routes/wp-v2-global-styles-id.json | 73 --- .../wp-v2-global-styles-parent-revisions.json | 48 -- ...l-styles-themes-stylesheet-variations.json | 18 - ...wp-v2-global-styles-themes-stylesheet.json | 18 - .../rest-api/routes/wp-v2-media-id-edit.json | 137 ---- .../routes/wp-v2-media-id-post-process.json | 25 - .../data/rest-api/routes/wp-v2-media-id.json | 215 ------- tests/data/rest-api/routes/wp-v2-media.json | 374 ----------- .../routes/wp-v2-menu-items-id-autosaves.json | 162 ----- .../rest-api/routes/wp-v2-menu-items-id.json | 199 ------ .../wp-v2-menu-items-parent-autosaves-id.json | 34 - .../rest-api/routes/wp-v2-menu-items.json | 408 ------------ .../routes/wp-v2-menu-locations-location.json | 29 - .../rest-api/routes/wp-v2-menu-locations.json | 31 - .../data/rest-api/routes/wp-v2-menus-id.json | 108 ---- tests/data/rest-api/routes/wp-v2-menus.json | 168 ----- .../routes/wp-v2-navigation-id-autosaves.json | 156 ----- .../rest-api/routes/wp-v2-navigation-id.json | 193 ------ .../wp-v2-navigation-parent-autosaves-id.json | 34 - .../wp-v2-navigation-parent-revisions-id.json | 58 -- .../wp-v2-navigation-parent-revisions.json | 96 --- .../rest-api/routes/wp-v2-navigation.json | 300 --------- .../routes/wp-v2-pages-id-autosaves.json | 231 ------- .../data/rest-api/routes/wp-v2-pages-id.json | 273 -------- .../wp-v2-pages-parent-autosaves-id.json | 34 - .../wp-v2-pages-parent-revisions-id.json | 58 -- .../routes/wp-v2-pages-parent-revisions.json | 96 --- tests/data/rest-api/routes/wp-v2-pages.json | 422 ------------ .../wp-v2-pattern-directory-patterns.json | 103 --- .../rest-api/routes/wp-v2-plugins-plugin.json | 91 --- tests/data/rest-api/routes/wp-v2-plugins.json | 74 --- .../routes/wp-v2-posts-id-autosaves.json | 264 -------- .../data/rest-api/routes/wp-v2-posts-id.json | 301 --------- .../wp-v2-posts-parent-autosaves-id.json | 34 - .../wp-v2-posts-parent-revisions-id.json | 58 -- .../routes/wp-v2-posts-parent-revisions.json | 96 --- tests/data/rest-api/routes/wp-v2-posts.json | 604 ------------------ tests/data/rest-api/routes/wp-v2-search.json | 95 --- .../data/rest-api/routes/wp-v2-settings.json | 129 ---- .../rest-api/routes/wp-v2-sidebars-id.json | 52 -- .../data/rest-api/routes/wp-v2-sidebars.json | 31 - .../routes/wp-v2-statuses-status.json | 29 - .../data/rest-api/routes/wp-v2-statuses.json | 31 - tests/data/rest-api/routes/wp-v2-tags-id.json | 95 --- tests/data/rest-api/routes/wp-v2-tags.json | 155 ----- .../routes/wp-v2-taxonomies-taxonomy.json | 29 - .../rest-api/routes/wp-v2-taxonomies.json | 36 -- .../wp-v2-template-parts-id-autosaves.json | 141 ---- .../routes/wp-v2-template-parts-id.json | 164 ----- .../routes/wp-v2-template-parts-lookup.json | 35 - ...v2-template-parts-parent-autosaves-id.json | 34 - ...v2-template-parts-parent-revisions-id.json | 58 -- ...wp-v2-template-parts-parent-revisions.json | 96 --- .../rest-api/routes/wp-v2-template-parts.json | 157 ----- .../routes/wp-v2-templates-id-autosaves.json | 136 ---- .../rest-api/routes/wp-v2-templates-id.json | 159 ----- .../routes/wp-v2-templates-lookup.json | 35 - .../wp-v2-templates-parent-autosaves-id.json | 34 - .../wp-v2-templates-parent-revisions-id.json | 58 -- .../wp-v2-templates-parent-revisions.json | 96 --- .../data/rest-api/routes/wp-v2-templates.json | 152 ----- .../routes/wp-v2-themes-stylesheet.json | 18 - tests/data/rest-api/routes/wp-v2-themes.json | 32 - .../rest-api/routes/wp-v2-types-type.json | 29 - tests/data/rest-api/routes/wp-v2-types.json | 31 - .../data/rest-api/routes/wp-v2-users-id.json | 167 ----- .../data/rest-api/routes/wp-v2-users-me.json | 159 ----- ...d-me-application-passwords-introspect.json | 24 - ...user-id-me-application-passwords-uuid.json | 56 -- ...sers-user-id-me-application-passwords.json | 52 -- tests/data/rest-api/routes/wp-v2-users.json | 258 -------- .../routes/wp-v2-widget-types-id-encode.json | 28 - .../routes/wp-v2-widget-types-id-render.json | 23 - .../routes/wp-v2-widget-types-id.json | 29 - .../rest-api/routes/wp-v2-widget-types.json | 31 - .../rest-api/routes/wp-v2-widgets-id.json | 106 --- tests/data/rest-api/routes/wp-v2-widgets.json | 99 --- .../routes/wp-v2-wp-pattern-category-id.json | 95 --- .../routes/wp-v2-wp-pattern-category.json | 155 ----- tests/data/rest-api/routes/wp-v2.json | 28 - tests/output/routes.php | 6 +- 98 files changed, 5 insertions(+), 10943 deletions(-) diff --git a/tests/data/rest-api/routes/wp-v2-block-directory-search.json b/tests/data/rest-api/routes/wp-v2-block-directory-search.json index 0599bfe..40725e2 100644 --- a/tests/data/rest-api/routes/wp-v2-block-directory-search.json +++ b/tests/data/rest-api/routes/wp-v2-block-directory-search.json @@ -1,53 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "term": { - "description": "Limit result set to blocks matching the search term.", - "type": "string", - "minLength": 1, - "required": true - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/block-directory/search" - } - ] - }, "route": "/wp/v2/block-directory/search" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-block-patterns-categories.json b/tests/data/rest-api/routes/wp-v2-block-patterns-categories.json index 5280bb1..ca079eb 100644 --- a/tests/data/rest-api/routes/wp-v2-block-patterns-categories.json +++ b/tests/data/rest-api/routes/wp-v2-block-patterns-categories.json @@ -1,22 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": [] - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/block-patterns/categories" - } - ] - }, "route": "/wp/v2/block-patterns/categories" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-block-patterns-patterns.json b/tests/data/rest-api/routes/wp-v2-block-patterns-patterns.json index 23f6662..761597c 100644 --- a/tests/data/rest-api/routes/wp-v2-block-patterns-patterns.json +++ b/tests/data/rest-api/routes/wp-v2-block-patterns-patterns.json @@ -1,22 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": [] - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/block-patterns/patterns" - } - ] - }, "route": "/wp/v2/block-patterns/patterns" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-block-renderer-name.json b/tests/data/rest-api/routes/wp-v2-block-renderer-name.json index 1596fcf..7027ca8 100644 --- a/tests/data/rest-api/routes/wp-v2-block-renderer-name.json +++ b/tests/data/rest-api/routes/wp-v2-block-renderer-name.json @@ -1,43 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET", - "POST" - ], - "args": { - "name": { - "description": "Unique registered name for the block.", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "edit" - ], - "default": "view", - "required": false - }, - "attributes": { - "description": "Attributes for the block.", - "type": "object", - "default": [], - "required": false - }, - "post_id": { - "description": "ID of the post context.", - "type": "integer", - "required": false - } - } - } - ], "route": "/wp/v2/block-renderer/(?P[a-z0-9-]+/[a-z0-9-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-block-types-namespace-name.json b/tests/data/rest-api/routes/wp-v2-block-types-namespace-name.json index 38d5166..3278e8e 100644 --- a/tests/data/rest-api/routes/wp-v2-block-types-namespace-name.json +++ b/tests/data/rest-api/routes/wp-v2-block-types-namespace-name.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "name": { - "description": "Block name.", - "type": "string", - "required": false - }, - "namespace": { - "description": "Block namespace.", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/block-types/(?P[a-zA-Z0-9_-]+)/(?P[a-zA-Z0-9_-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-block-types-namespace.json b/tests/data/rest-api/routes/wp-v2-block-types-namespace.json index 8df465e..ee8e3d9 100644 --- a/tests/data/rest-api/routes/wp-v2-block-types-namespace.json +++ b/tests/data/rest-api/routes/wp-v2-block-types-namespace.json @@ -1,32 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "namespace": { - "description": "Block namespace.", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/block-types/(?P[a-zA-Z0-9_-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-block-types.json b/tests/data/rest-api/routes/wp-v2-block-types.json index bc6b414..46ef676 100644 --- a/tests/data/rest-api/routes/wp-v2-block-types.json +++ b/tests/data/rest-api/routes/wp-v2-block-types.json @@ -1,39 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "namespace": { - "description": "Block namespace.", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/block-types" - } - ] - }, "route": "/wp/v2/block-types" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json index 4d71da4..2008e4b 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id-autosaves.json @@ -1,162 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "wp_pattern_sync_status": { - "type": "string", - "description": "", - "default": "", - "enum": [ - "partial", - "unsynced" - ] - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "wp_pattern_category": { - "description": "The terms assigned to the post in the wp_pattern_category taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - } - } - } - ], "route": "/wp/v2/blocks/(?P[\\d]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-blocks-id.json b/tests/data/rest-api/routes/wp-v2-blocks-id.json index 9648c36..d46ecba 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-id.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-id.json @@ -1,199 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "password": { - "description": "The password for the post if it is password protected.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "wp_pattern_sync_status": { - "type": "string", - "description": "", - "default": "", - "enum": [ - "partial", - "unsynced" - ] - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "wp_pattern_category": { - "description": "The terms assigned to the post in the wp_pattern_category taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/blocks/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-blocks-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-blocks-parent-autosaves-id.json index db8939e..feddfa5 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-parent-autosaves-id.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "id": { - "description": "The ID for the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/blocks/(?P[\\d]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions-id.json index 3afefe2..6f444a7 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions-id.json @@ -1,61 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as revisions do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/blocks/(?P[\\d]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions.json index 264d754..6ed15f7 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-blocks-parent-revisions.json @@ -1,99 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "date", - "enum": [ - "date", - "id", - "include", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - } - } - } - ], "route": "/wp/v2/blocks/(?P[\\d]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-blocks.json b/tests/data/rest-api/routes/wp-v2-blocks.json index c14442b..ca96f4b 100644 --- a/tests/data/rest-api/routes/wp-v2-blocks.json +++ b/tests/data/rest-api/routes/wp-v2-blocks.json @@ -1,392 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "after": { - "description": "Limit response to posts published after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_after": { - "description": "Limit response to posts modified after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "before": { - "description": "Limit response to posts published before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_before": { - "description": "Limit response to posts modified before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by post attribute.", - "type": "string", - "default": "date", - "enum": [ - "author", - "date", - "id", - "include", - "modified", - "parent", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - }, - "search_columns": { - "default": [], - "description": "Array of column names to be searched.", - "type": "array", - "items": { - "enum": [ - "post_title", - "post_content", - "post_excerpt" - ], - "type": "string" - }, - "required": false - }, - "slug": { - "description": "Limit result set to posts with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "status": { - "default": "publish", - "description": "Limit result set to posts assigned one or more statuses.", - "type": "array", - "items": { - "enum": [ - "publish", - "future", - "draft", - "pending", - "private", - "trash", - "auto-draft", - "inherit", - "request-pending", - "request-confirmed", - "request-failed", - "request-completed", - "any" - ], - "type": "string" - }, - "required": false - }, - "tax_relation": { - "description": "Limit result set based on relationship between multiple taxonomies.", - "type": "string", - "enum": [ - "AND", - "OR" - ], - "required": false - }, - "wp_pattern_category": { - "description": "Limit result set to items with specific terms assigned in the wp_pattern_category taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - }, - "operator": { - "description": "Whether items must be assigned all or any of the specified terms.", - "type": "string", - "enum": [ - "AND", - "OR" - ], - "default": "OR" - } - }, - "additionalProperties": false - } - ], - "required": false - }, - "wp_pattern_category_exclude": { - "description": "Limit result set to items except those with specific terms assigned in the wp_pattern_category taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - } - }, - "additionalProperties": false - } - ], - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "wp_pattern_sync_status": { - "type": "string", - "description": "", - "default": "", - "enum": [ - "partial", - "unsynced" - ] - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "wp_pattern_category": { - "description": "The terms assigned to the post in the wp_pattern_category taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/blocks" - } - ] - }, "route": "/wp/v2/blocks" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-categories-id.json b/tests/data/rest-api/routes/wp-v2-categories-id.json index 9b01d58..ccaf914 100644 --- a/tests/data/rest-api/routes/wp-v2-categories-id.json +++ b/tests/data/rest-api/routes/wp-v2-categories-id.json @@ -1,103 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "parent": { - "description": "The parent term ID.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as terms do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/categories/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-categories.json b/tests/data/rest-api/routes/wp-v2-categories.json index 7ba8fe7..e32ab7c 100644 --- a/tests/data/rest-api/routes/wp-v2-categories.json +++ b/tests/data/rest-api/routes/wp-v2-categories.json @@ -1,163 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "asc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by term attribute.", - "type": "string", - "default": "name", - "enum": [ - "id", - "include", - "name", - "slug", - "include_slugs", - "term_group", - "description", - "count" - ], - "required": false - }, - "hide_empty": { - "description": "Whether to hide terms not assigned to any posts.", - "type": "boolean", - "default": false, - "required": false - }, - "parent": { - "description": "Limit result set to terms assigned to a specific parent.", - "type": "integer", - "required": false - }, - "post": { - "description": "Limit result set to terms assigned to a specific post.", - "type": "integer", - "default": null, - "required": false - }, - "slug": { - "description": "Limit result set to terms with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": true - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "parent": { - "description": "The parent term ID.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/categories" - } - ] - }, "route": "/wp/v2/categories" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-comments-id.json b/tests/data/rest-api/routes/wp-v2-comments-id.json index 598b714..12c9c80 100644 --- a/tests/data/rest-api/routes/wp-v2-comments-id.json +++ b/tests/data/rest-api/routes/wp-v2-comments-id.json @@ -1,168 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "Unique identifier for the comment.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "password": { - "description": "The password for the parent post of the comment (if the post is password protected).", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "id": { - "description": "Unique identifier for the comment.", - "type": "integer", - "required": false - }, - "author": { - "description": "The ID of the user object, if author was a user.", - "type": "integer", - "required": false - }, - "author_email": { - "description": "Email address for the comment author.", - "type": "string", - "format": "email", - "required": false - }, - "author_ip": { - "description": "IP address for the comment author.", - "type": "string", - "format": "ip", - "required": false - }, - "author_name": { - "description": "Display name for the comment author.", - "type": "string", - "required": false - }, - "author_url": { - "description": "URL for the comment author.", - "type": "string", - "format": "uri", - "required": false - }, - "author_user_agent": { - "description": "User agent for the comment author.", - "type": "string", - "required": false - }, - "content": { - "description": "The content for the comment.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the comment, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the comment, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "date": { - "description": "The date the comment was published, in the site's timezone.", - "type": "string", - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the comment was published, as GMT.", - "type": "string", - "format": "date-time", - "required": false - }, - "parent": { - "description": "The ID for the parent of the comment.", - "type": "integer", - "required": false - }, - "post": { - "description": "The ID of the associated post object.", - "type": "integer", - "required": false - }, - "status": { - "description": "State of the comment.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "id": { - "description": "Unique identifier for the comment.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - }, - "password": { - "description": "The password for the parent post of the comment (if the post is password protected).", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/comments/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-comments.json b/tests/data/rest-api/routes/wp-v2-comments.json index 66a4e0f..27b6e77 100644 --- a/tests/data/rest-api/routes/wp-v2-comments.json +++ b/tests/data/rest-api/routes/wp-v2-comments.json @@ -1,281 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "after": { - "description": "Limit response to comments published after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "author": { - "description": "Limit result set to comments assigned to specific user IDs. Requires authorization.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "author_exclude": { - "description": "Ensure result set excludes comments assigned to specific user IDs. Requires authorization.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "author_email": { - "default": null, - "description": "Limit result set to that from a specific author email. Requires authorization.", - "format": "email", - "type": "string", - "required": false - }, - "before": { - "description": "Limit response to comments published before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by comment attribute.", - "type": "string", - "default": "date_gmt", - "enum": [ - "date", - "date_gmt", - "id", - "include", - "post", - "parent", - "type" - ], - "required": false - }, - "parent": { - "default": [], - "description": "Limit result set to comments of specific parent IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "parent_exclude": { - "default": [], - "description": "Ensure result set excludes specific parent IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "post": { - "default": [], - "description": "Limit result set to comments assigned to specific post IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "status": { - "default": "approve", - "description": "Limit result set to comments assigned a specific status. Requires authorization.", - "type": "string", - "required": false - }, - "type": { - "default": "comment", - "description": "Limit result set to comments assigned a specific type. Requires authorization.", - "type": "string", - "required": false - }, - "password": { - "description": "The password for the post if it is password protected.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "author": { - "description": "The ID of the user object, if author was a user.", - "type": "integer", - "required": false - }, - "author_email": { - "description": "Email address for the comment author.", - "type": "string", - "format": "email", - "required": false - }, - "author_ip": { - "description": "IP address for the comment author.", - "type": "string", - "format": "ip", - "required": false - }, - "author_name": { - "description": "Display name for the comment author.", - "type": "string", - "required": false - }, - "author_url": { - "description": "URL for the comment author.", - "type": "string", - "format": "uri", - "required": false - }, - "author_user_agent": { - "description": "User agent for the comment author.", - "type": "string", - "required": false - }, - "content": { - "description": "The content for the comment.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the comment, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the comment, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "date": { - "description": "The date the comment was published, in the site's timezone.", - "type": "string", - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the comment was published, as GMT.", - "type": "string", - "format": "date-time", - "required": false - }, - "parent": { - "default": 0, - "description": "The ID for the parent of the comment.", - "type": "integer", - "required": false - }, - "post": { - "default": 0, - "description": "The ID of the associated post object.", - "type": "integer", - "required": false - }, - "status": { - "description": "State of the comment.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/comments" - } - ] - }, "route": "/wp/v2/comments" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-global-styles-id.json b/tests/data/rest-api/routes/wp-v2-global-styles-id.json index ae6f087..5fa0dee 100644 --- a/tests/data/rest-api/routes/wp-v2-global-styles-id.json +++ b/tests/data/rest-api/routes/wp-v2-global-styles-id.json @@ -1,76 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "styles": { - "description": "Global styles.", - "type": [ - "object" - ], - "required": false - }, - "settings": { - "description": "Global settings.", - "type": [ - "object" - ], - "required": false - }, - "title": { - "description": "Title of the global styles variation.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Title for the global styles variation, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - } - } - } - ], "route": "/wp/v2/global-styles/(?P[\\/\\w-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions.json index 6217df3..f5143ea 100644 --- a/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-global-styles-parent-revisions.json @@ -1,51 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "minimum": 1, - "maximum": 100, - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - } - } - } - ], "route": "/wp/v2/global-styles/(?P[\\d]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet-variations.json b/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet-variations.json index a4a3969..736d0cc 100644 --- a/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet-variations.json +++ b/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet-variations.json @@ -1,21 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "stylesheet": { - "description": "The theme identifier", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/global-styles/themes/(?P[\\/\\s%\\w\\.\\(\\)\\[\\]\\@_\\-]+)/variations" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet.json b/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet.json index 8718409..a483e86 100644 --- a/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet.json +++ b/tests/data/rest-api/routes/wp-v2-global-styles-themes-stylesheet.json @@ -1,21 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "stylesheet": { - "description": "The theme identifier", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/global-styles/themes/(?P[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-media-id-edit.json b/tests/data/rest-api/routes/wp-v2-media-id-edit.json index 03081ff..19c4267 100644 --- a/tests/data/rest-api/routes/wp-v2-media-id-edit.json +++ b/tests/data/rest-api/routes/wp-v2-media-id-edit.json @@ -1,140 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "POST" - ], - "endpoints": [ - { - "methods": [ - "POST" - ], - "args": { - "src": { - "description": "URL to the edited image file.", - "type": "string", - "format": "uri", - "required": true - }, - "modifiers": { - "description": "Array of image edits.", - "type": "array", - "minItems": 1, - "items": { - "description": "Image edit.", - "type": "object", - "required": [ - "type", - "args" - ], - "oneOf": [ - { - "title": "Rotation", - "properties": { - "type": { - "description": "Rotation type.", - "type": "string", - "enum": [ - "rotate" - ] - }, - "args": { - "description": "Rotation arguments.", - "type": "object", - "required": [ - "angle" - ], - "properties": { - "angle": { - "description": "Angle to rotate clockwise in degrees.", - "type": "number" - } - } - } - } - }, - { - "title": "Crop", - "properties": { - "type": { - "description": "Crop type.", - "type": "string", - "enum": [ - "crop" - ] - }, - "args": { - "description": "Crop arguments.", - "type": "object", - "required": [ - "left", - "top", - "width", - "height" - ], - "properties": { - "left": { - "description": "Horizontal position from the left to begin the crop as a percentage of the image width.", - "type": "number" - }, - "top": { - "description": "Vertical position from the top to begin the crop as a percentage of the image height.", - "type": "number" - }, - "width": { - "description": "Width of the crop as a percentage of the image width.", - "type": "number" - }, - "height": { - "description": "Height of the crop as a percentage of the image height.", - "type": "number" - } - } - } - } - } - ] - }, - "required": false - }, - "rotation": { - "description": "The amount to rotate the image clockwise in degrees. DEPRECATED: Use `modifiers` instead.", - "type": "integer", - "minimum": 0, - "exclusiveMinimum": true, - "maximum": 360, - "exclusiveMaximum": true, - "required": false - }, - "x": { - "description": "As a percentage of the image, the x position to start the crop from. DEPRECATED: Use `modifiers` instead.", - "type": "number", - "minimum": 0, - "maximum": 100, - "required": false - }, - "y": { - "description": "As a percentage of the image, the y position to start the crop from. DEPRECATED: Use `modifiers` instead.", - "type": "number", - "minimum": 0, - "maximum": 100, - "required": false - }, - "width": { - "description": "As a percentage of the image, the width to crop the image to. DEPRECATED: Use `modifiers` instead.", - "type": "number", - "minimum": 0, - "maximum": 100, - "required": false - }, - "height": { - "description": "As a percentage of the image, the height to crop the image to. DEPRECATED: Use `modifiers` instead.", - "type": "number", - "minimum": 0, - "maximum": 100, - "required": false - } - } - } - ], "route": "/wp/v2/media/(?P[\\d]+)/edit" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-media-id-post-process.json b/tests/data/rest-api/routes/wp-v2-media-id-post-process.json index 159c9f6..4a4453d 100644 --- a/tests/data/rest-api/routes/wp-v2-media-id-post-process.json +++ b/tests/data/rest-api/routes/wp-v2-media-id-post-process.json @@ -1,28 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "POST" - ], - "endpoints": [ - { - "methods": [ - "POST" - ], - "args": { - "id": { - "description": "Unique identifier for the attachment.", - "type": "integer", - "required": false - }, - "action": { - "type": "string", - "enum": [ - "create-image-subsizes" - ], - "required": true - } - } - } - ], "route": "/wp/v2/media/(?P[\\d]+)/post-process" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-media-id.json b/tests/data/rest-api/routes/wp-v2-media-id.json index fa27d77..be70b29 100644 --- a/tests/data/rest-api/routes/wp-v2-media-id.json +++ b/tests/data/rest-api/routes/wp-v2-media-id.json @@ -1,218 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "alt_text": { - "description": "Alternative text to display when attachment is not displayed.", - "type": "string", - "required": false - }, - "caption": { - "description": "The attachment caption.", - "type": "object", - "properties": { - "raw": { - "description": "Caption for the attachment, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML caption for the attachment, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "description": "The attachment description.", - "type": "object", - "properties": { - "raw": { - "description": "Description for the attachment, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML description for the attachment, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "post": { - "description": "The ID for the associated post of the attachment.", - "type": "integer", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/media/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-media.json b/tests/data/rest-api/routes/wp-v2-media.json index d5720b2..288406a 100644 --- a/tests/data/rest-api/routes/wp-v2-media.json +++ b/tests/data/rest-api/routes/wp-v2-media.json @@ -1,377 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "after": { - "description": "Limit response to posts published after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_after": { - "description": "Limit response to posts modified after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "author": { - "description": "Limit result set to posts assigned to specific authors.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "author_exclude": { - "description": "Ensure result set excludes posts assigned to specific authors.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "before": { - "description": "Limit response to posts published before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_before": { - "description": "Limit response to posts modified before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by post attribute.", - "type": "string", - "default": "date", - "enum": [ - "author", - "date", - "id", - "include", - "modified", - "parent", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - }, - "parent": { - "description": "Limit result set to items with particular parent IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "parent_exclude": { - "description": "Limit result set to all items except those of a particular parent ID.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "search_columns": { - "default": [], - "description": "Array of column names to be searched.", - "type": "array", - "items": { - "enum": [ - "post_title", - "post_content", - "post_excerpt" - ], - "type": "string" - }, - "required": false - }, - "slug": { - "description": "Limit result set to posts with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "status": { - "default": "inherit", - "description": "Limit result set to posts assigned one or more statuses.", - "type": "array", - "items": { - "enum": [ - "inherit", - "private", - "trash" - ], - "type": "string" - }, - "required": false - }, - "media_type": { - "default": null, - "description": "Limit result set to attachments of a particular media type.", - "type": "string", - "enum": [ - "image", - "video", - "audio", - "application" - ], - "required": false - }, - "mime_type": { - "default": null, - "description": "Limit result set to attachments of a particular MIME type.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "alt_text": { - "description": "Alternative text to display when attachment is not displayed.", - "type": "string", - "required": false - }, - "caption": { - "description": "The attachment caption.", - "type": "object", - "properties": { - "raw": { - "description": "Caption for the attachment, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML caption for the attachment, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "description": "The attachment description.", - "type": "object", - "properties": { - "raw": { - "description": "Description for the attachment, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML description for the attachment, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "post": { - "description": "The ID for the associated post of the attachment.", - "type": "integer", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/media" - } - ] - }, "route": "/wp/v2/media" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menu-items-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-menu-items-id-autosaves.json index bff0ed5..75b5794 100644 --- a/tests/data/rest-api/routes/wp-v2-menu-items-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-menu-items-id-autosaves.json @@ -1,165 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "parent": { - "description": "The ID for the parent of the object.", - "type": "integer", - "minimum": 0, - "required": false - }, - "title": { - "description": "The title for the object.", - "type": [ - "string", - "object" - ], - "properties": { - "raw": { - "description": "Title for the object, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the object, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "type": { - "description": "The family of objects originally represented, such as \"post_type\" or \"taxonomy\".", - "type": "string", - "enum": [ - "taxonomy", - "post_type", - "post_type_archive", - "custom" - ], - "required": false - }, - "status": { - "description": "A named status for the object.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "attr_title": { - "description": "Text for the title attribute of the link element for this menu item.", - "type": "string", - "required": false - }, - "classes": { - "description": "Class names for the link element of this menu item.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "description": { - "description": "The description of this menu item.", - "type": "string", - "required": false - }, - "menu_order": { - "description": "The DB ID of the nav_menu_item that is this item's menu parent, if any, otherwise 0.", - "type": "integer", - "minimum": 1, - "required": false - }, - "object": { - "description": "The type of object originally represented, such as \"category\", \"post\", or \"attachment\".", - "type": "string", - "required": false - }, - "object_id": { - "description": "The database ID of the original object this menu item represents, for example the ID for posts or the term_id for categories.", - "type": "integer", - "minimum": 0, - "required": false - }, - "target": { - "description": "The target attribute of the link element for this menu item.", - "type": "string", - "enum": [ - "_blank", - "" - ], - "required": false - }, - "url": { - "description": "The URL to which this menu item points.", - "type": "string", - "format": "uri", - "required": false - }, - "xfn": { - "description": "The XFN relationship expressed in the link of this menu item.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "menus": { - "description": "The terms assigned to the object in the nav_menu taxonomy.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - } - ], "route": "/wp/v2/menu-items/(?P[\\d]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menu-items-id.json b/tests/data/rest-api/routes/wp-v2-menu-items-id.json index 2769907..81c0e4a 100644 --- a/tests/data/rest-api/routes/wp-v2-menu-items-id.json +++ b/tests/data/rest-api/routes/wp-v2-menu-items-id.json @@ -1,202 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "title": { - "description": "The title for the object.", - "type": [ - "string", - "object" - ], - "properties": { - "raw": { - "description": "Title for the object, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the object, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "type": { - "description": "The family of objects originally represented, such as \"post_type\" or \"taxonomy\".", - "type": "string", - "enum": [ - "taxonomy", - "post_type", - "post_type_archive", - "custom" - ], - "required": false - }, - "status": { - "description": "A named status for the object.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "parent": { - "description": "The ID for the parent of the object.", - "type": "integer", - "minimum": 0, - "required": false - }, - "attr_title": { - "description": "Text for the title attribute of the link element for this menu item.", - "type": "string", - "required": false - }, - "classes": { - "description": "Class names for the link element of this menu item.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "description": { - "description": "The description of this menu item.", - "type": "string", - "required": false - }, - "menu_order": { - "description": "The DB ID of the nav_menu_item that is this item's menu parent, if any, otherwise 0.", - "type": "integer", - "minimum": 1, - "required": false - }, - "object": { - "description": "The type of object originally represented, such as \"category\", \"post\", or \"attachment\".", - "type": "string", - "required": false - }, - "object_id": { - "description": "The database ID of the original object this menu item represents, for example the ID for posts or the term_id for categories.", - "type": "integer", - "minimum": 0, - "required": false - }, - "target": { - "description": "The target attribute of the link element for this menu item.", - "type": "string", - "enum": [ - "_blank", - "" - ], - "required": false - }, - "url": { - "description": "The URL to which this menu item points.", - "type": "string", - "format": "uri", - "required": false - }, - "xfn": { - "description": "The XFN relationship expressed in the link of this menu item.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "menus": { - "description": "The terms assigned to the object in the nav_menu taxonomy.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/menu-items/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menu-items-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-menu-items-parent-autosaves-id.json index f375281..05eafab 100644 --- a/tests/data/rest-api/routes/wp-v2-menu-items-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-menu-items-parent-autosaves-id.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "id": { - "description": "The ID for the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/menu-items/(?P[\\d]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menu-items.json b/tests/data/rest-api/routes/wp-v2-menu-items.json index 1b3cd41..46f3d3e 100644 --- a/tests/data/rest-api/routes/wp-v2-menu-items.json +++ b/tests/data/rest-api/routes/wp-v2-menu-items.json @@ -1,411 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 100, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "after": { - "description": "Limit response to posts published after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_after": { - "description": "Limit response to posts modified after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "before": { - "description": "Limit response to posts published before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_before": { - "description": "Limit response to posts modified before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "asc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "menu_order", - "enum": [ - "author", - "date", - "id", - "include", - "modified", - "parent", - "relevance", - "slug", - "include_slugs", - "title", - "menu_order" - ], - "required": false - }, - "search_columns": { - "default": [], - "description": "Array of column names to be searched.", - "type": "array", - "items": { - "enum": [ - "post_title", - "post_content", - "post_excerpt" - ], - "type": "string" - }, - "required": false - }, - "slug": { - "description": "Limit result set to posts with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "status": { - "default": "publish", - "description": "Limit result set to posts assigned one or more statuses.", - "type": "array", - "items": { - "enum": [ - "publish", - "future", - "draft", - "pending", - "private", - "trash", - "auto-draft", - "inherit", - "request-pending", - "request-confirmed", - "request-failed", - "request-completed", - "any" - ], - "type": "string" - }, - "required": false - }, - "tax_relation": { - "description": "Limit result set based on relationship between multiple taxonomies.", - "type": "string", - "enum": [ - "AND", - "OR" - ], - "required": false - }, - "menus": { - "description": "Limit result set to items with specific terms assigned in the menus taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - }, - "operator": { - "description": "Whether items must be assigned all or any of the specified terms.", - "type": "string", - "enum": [ - "AND", - "OR" - ], - "default": "OR" - } - }, - "additionalProperties": false - } - ], - "required": false - }, - "menus_exclude": { - "description": "Limit result set to items except those with specific terms assigned in the menus taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - } - }, - "additionalProperties": false - } - ], - "required": false - }, - "menu_order": { - "description": "Limit result set to posts with a specific menu_order value.", - "type": "integer", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "title": { - "description": "The title for the object.", - "type": [ - "string", - "object" - ], - "properties": { - "raw": { - "description": "Title for the object, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the object, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "type": { - "default": "custom", - "description": "The family of objects originally represented, such as \"post_type\" or \"taxonomy\".", - "type": "string", - "enum": [ - "taxonomy", - "post_type", - "post_type_archive", - "custom" - ], - "required": false - }, - "status": { - "default": "publish", - "description": "A named status for the object.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "parent": { - "default": 0, - "description": "The ID for the parent of the object.", - "type": "integer", - "minimum": 0, - "required": false - }, - "attr_title": { - "description": "Text for the title attribute of the link element for this menu item.", - "type": "string", - "required": false - }, - "classes": { - "description": "Class names for the link element of this menu item.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "description": { - "description": "The description of this menu item.", - "type": "string", - "required": false - }, - "menu_order": { - "default": 1, - "description": "The DB ID of the nav_menu_item that is this item's menu parent, if any, otherwise 0.", - "type": "integer", - "minimum": 1, - "required": false - }, - "object": { - "description": "The type of object originally represented, such as \"category\", \"post\", or \"attachment\".", - "type": "string", - "required": false - }, - "object_id": { - "default": 0, - "description": "The database ID of the original object this menu item represents, for example the ID for posts or the term_id for categories.", - "type": "integer", - "minimum": 0, - "required": false - }, - "target": { - "description": "The target attribute of the link element for this menu item.", - "type": "string", - "enum": [ - "_blank", - "" - ], - "required": false - }, - "url": { - "description": "The URL to which this menu item points.", - "type": "string", - "format": "uri", - "required": false - }, - "xfn": { - "description": "The XFN relationship expressed in the link of this menu item.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "menus": { - "description": "The terms assigned to the object in the nav_menu taxonomy.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/menu-items" - } - ] - }, "route": "/wp/v2/menu-items" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menu-locations-location.json b/tests/data/rest-api/routes/wp-v2-menu-locations-location.json index cbdeeb6..1ffcf48 100644 --- a/tests/data/rest-api/routes/wp-v2-menu-locations-location.json +++ b/tests/data/rest-api/routes/wp-v2-menu-locations-location.json @@ -1,32 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "location": { - "description": "An alphanumeric identifier for the menu location.", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/menu-locations/(?P[\\w-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menu-locations.json b/tests/data/rest-api/routes/wp-v2-menu-locations.json index 389c50a..15a22e9 100644 --- a/tests/data/rest-api/routes/wp-v2-menu-locations.json +++ b/tests/data/rest-api/routes/wp-v2-menu-locations.json @@ -1,34 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/menu-locations" - } - ] - }, "route": "/wp/v2/menu-locations" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menus-id.json b/tests/data/rest-api/routes/wp-v2-menus-id.json index dd42331..f970006 100644 --- a/tests/data/rest-api/routes/wp-v2-menus-id.json +++ b/tests/data/rest-api/routes/wp-v2-menus-id.json @@ -1,111 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - }, - "locations": { - "description": "The locations assigned to the menu.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "auto_add": { - "description": "Whether to automatically add top level pages to this menu.", - "type": "boolean", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as terms do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/menus/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-menus.json b/tests/data/rest-api/routes/wp-v2-menus.json index 9e12098..ba889cc 100644 --- a/tests/data/rest-api/routes/wp-v2-menus.json +++ b/tests/data/rest-api/routes/wp-v2-menus.json @@ -1,171 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "asc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by term attribute.", - "type": "string", - "default": "name", - "enum": [ - "id", - "include", - "name", - "slug", - "include_slugs", - "term_group", - "description", - "count" - ], - "required": false - }, - "hide_empty": { - "description": "Whether to hide terms not assigned to any posts.", - "type": "boolean", - "default": false, - "required": false - }, - "post": { - "description": "Limit result set to terms assigned to a specific post.", - "type": "integer", - "default": null, - "required": false - }, - "slug": { - "description": "Limit result set to terms with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": true - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - }, - "locations": { - "description": "The locations assigned to the menu.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "auto_add": { - "description": "Whether to automatically add top level pages to this menu.", - "type": "boolean", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/menus" - } - ] - }, "route": "/wp/v2/menus" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json index 173984d..cc54ef7 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-navigation-id-autosaves.json @@ -1,159 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/navigation/(?P[\\d]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-navigation-id.json b/tests/data/rest-api/routes/wp-v2-navigation-id.json index 7118e5c..cb36253 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation-id.json +++ b/tests/data/rest-api/routes/wp-v2-navigation-id.json @@ -1,196 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "password": { - "description": "The password for the post if it is password protected.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/navigation/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-navigation-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-navigation-parent-autosaves-id.json index 951fddf..9035545 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-navigation-parent-autosaves-id.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "id": { - "description": "The ID for the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/navigation/(?P[\\d]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions-id.json index dd9b009..741c78d 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions-id.json @@ -1,61 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as revisions do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/navigation/(?P[\\d]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions.json index a2f8677..aef363f 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-navigation-parent-revisions.json @@ -1,99 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "date", - "enum": [ - "date", - "id", - "include", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - } - } - } - ], "route": "/wp/v2/navigation/(?P[\\d]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-navigation.json b/tests/data/rest-api/routes/wp-v2-navigation.json index 7f97a63..2bb570f 100644 --- a/tests/data/rest-api/routes/wp-v2-navigation.json +++ b/tests/data/rest-api/routes/wp-v2-navigation.json @@ -1,303 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "after": { - "description": "Limit response to posts published after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_after": { - "description": "Limit response to posts modified after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "before": { - "description": "Limit response to posts published before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_before": { - "description": "Limit response to posts modified before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by post attribute.", - "type": "string", - "default": "date", - "enum": [ - "author", - "date", - "id", - "include", - "modified", - "parent", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - }, - "search_columns": { - "default": [], - "description": "Array of column names to be searched.", - "type": "array", - "items": { - "enum": [ - "post_title", - "post_content", - "post_excerpt" - ], - "type": "string" - }, - "required": false - }, - "slug": { - "description": "Limit result set to posts with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "status": { - "default": "publish", - "description": "Limit result set to posts assigned one or more statuses.", - "type": "array", - "items": { - "enum": [ - "publish", - "future", - "draft", - "pending", - "private", - "trash", - "auto-draft", - "inherit", - "request-pending", - "request-confirmed", - "request-failed", - "request-completed", - "any" - ], - "type": "string" - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/navigation" - } - ] - }, "route": "/wp/v2/navigation" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json index 2ea08df..46b5d45 100644 --- a/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-pages-id-autosaves.json @@ -1,234 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "parent": { - "description": "The ID for the parent of the post.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "excerpt": { - "description": "The excerpt for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Excerpt for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML excerpt for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the excerpt is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "featured_media": { - "description": "The ID of the featured media for the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "menu_order": { - "description": "The order of the post in relation to other posts.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "footnotes": { - "type": "string", - "description": "", - "default": "" - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/pages/(?P[\\d]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-pages-id.json b/tests/data/rest-api/routes/wp-v2-pages-id.json index f39939c..2b8733d 100644 --- a/tests/data/rest-api/routes/wp-v2-pages-id.json +++ b/tests/data/rest-api/routes/wp-v2-pages-id.json @@ -1,276 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "password": { - "description": "The password for the post if it is password protected.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "parent": { - "description": "The ID for the parent of the post.", - "type": "integer", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "excerpt": { - "description": "The excerpt for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Excerpt for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML excerpt for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the excerpt is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "featured_media": { - "description": "The ID of the featured media for the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "menu_order": { - "description": "The order of the post in relation to other posts.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "footnotes": { - "type": "string", - "description": "", - "default": "" - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/pages/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-pages-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-pages-parent-autosaves-id.json index 7c3e0f3..6b28779 100644 --- a/tests/data/rest-api/routes/wp-v2-pages-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-pages-parent-autosaves-id.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "id": { - "description": "The ID for the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/pages/(?P[\\d]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-pages-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-pages-parent-revisions-id.json index 6d2d019..ec7ddc8 100644 --- a/tests/data/rest-api/routes/wp-v2-pages-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-pages-parent-revisions-id.json @@ -1,61 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as revisions do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/pages/(?P[\\d]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-pages-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-pages-parent-revisions.json index cbf95dc..06af0f2 100644 --- a/tests/data/rest-api/routes/wp-v2-pages-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-pages-parent-revisions.json @@ -1,99 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "date", - "enum": [ - "date", - "id", - "include", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - } - } - } - ], "route": "/wp/v2/pages/(?P[\\d]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-pages.json b/tests/data/rest-api/routes/wp-v2-pages.json index f9ac6fb..77ec7c8 100644 --- a/tests/data/rest-api/routes/wp-v2-pages.json +++ b/tests/data/rest-api/routes/wp-v2-pages.json @@ -1,425 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "after": { - "description": "Limit response to posts published after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_after": { - "description": "Limit response to posts modified after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "author": { - "description": "Limit result set to posts assigned to specific authors.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "author_exclude": { - "description": "Ensure result set excludes posts assigned to specific authors.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "before": { - "description": "Limit response to posts published before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_before": { - "description": "Limit response to posts modified before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "menu_order": { - "description": "Limit result set to posts with a specific menu_order value.", - "type": "integer", - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by post attribute.", - "type": "string", - "default": "date", - "enum": [ - "author", - "date", - "id", - "include", - "modified", - "parent", - "relevance", - "slug", - "include_slugs", - "title", - "menu_order" - ], - "required": false - }, - "parent": { - "description": "Limit result set to items with particular parent IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "parent_exclude": { - "description": "Limit result set to all items except those of a particular parent ID.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "search_columns": { - "default": [], - "description": "Array of column names to be searched.", - "type": "array", - "items": { - "enum": [ - "post_title", - "post_content", - "post_excerpt" - ], - "type": "string" - }, - "required": false - }, - "slug": { - "description": "Limit result set to posts with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "status": { - "default": "publish", - "description": "Limit result set to posts assigned one or more statuses.", - "type": "array", - "items": { - "enum": [ - "publish", - "future", - "draft", - "pending", - "private", - "trash", - "auto-draft", - "inherit", - "request-pending", - "request-confirmed", - "request-failed", - "request-completed", - "any" - ], - "type": "string" - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "parent": { - "description": "The ID for the parent of the post.", - "type": "integer", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "excerpt": { - "description": "The excerpt for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Excerpt for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML excerpt for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the excerpt is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "featured_media": { - "description": "The ID of the featured media for the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "menu_order": { - "description": "The order of the post in relation to other posts.", - "type": "integer", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "footnotes": { - "type": "string", - "description": "", - "default": "" - } - }, - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/pages" - } - ] - }, "route": "/wp/v2/pages" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-pattern-directory-patterns.json b/tests/data/rest-api/routes/wp-v2-pattern-directory-patterns.json index 7349149..a923c52 100644 --- a/tests/data/rest-api/routes/wp-v2-pattern-directory-patterns.json +++ b/tests/data/rest-api/routes/wp-v2-pattern-directory-patterns.json @@ -1,106 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 100, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "minLength": 1, - "required": false - }, - "category": { - "description": "Limit results to those matching a category ID.", - "type": "integer", - "minimum": 1, - "required": false - }, - "keyword": { - "description": "Limit results to those matching a keyword ID.", - "type": "integer", - "minimum": 1, - "required": false - }, - "slug": { - "description": "Limit results to those matching a pattern (slug).", - "type": "array", - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by post attribute.", - "type": "string", - "default": "date", - "enum": [ - "author", - "date", - "id", - "include", - "modified", - "parent", - "relevance", - "slug", - "include_slugs", - "title", - "favorite_count" - ], - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/pattern-directory/patterns" - } - ] - }, "route": "/wp/v2/pattern-directory/patterns" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-plugins-plugin.json b/tests/data/rest-api/routes/wp-v2-plugins-plugin.json index a03f855..f162800 100644 --- a/tests/data/rest-api/routes/wp-v2-plugins-plugin.json +++ b/tests/data/rest-api/routes/wp-v2-plugins-plugin.json @@ -1,94 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "plugin": { - "type": "string", - "pattern": "[^.\\/]+(?:\\/[^.\\/]+)?", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "plugin": { - "type": "string", - "pattern": "[^.\\/]+(?:\\/[^.\\/]+)?", - "required": false - }, - "status": { - "description": "The plugin activation status.", - "type": "string", - "enum": [ - "inactive", - "active", - "network-active" - ], - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "plugin": { - "type": "string", - "pattern": "[^.\\/]+(?:\\/[^.\\/]+)?", - "required": false - } - } - } - ], "route": "/wp/v2/plugins/(?P[^.\\/]+(?:\\/[^.\\/]+)?)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-plugins.json b/tests/data/rest-api/routes/wp-v2-plugins.json index e5db48a..4efc778 100644 --- a/tests/data/rest-api/routes/wp-v2-plugins.json +++ b/tests/data/rest-api/routes/wp-v2-plugins.json @@ -1,77 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "status": { - "description": "Limits results to plugins with the given status.", - "type": "array", - "items": { - "type": "string", - "enum": [ - "inactive", - "active", - "network-active" - ] - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "slug": { - "type": "string", - "description": "WordPress.org plugin directory slug.", - "pattern": "[\\w\\-]+", - "required": true - }, - "status": { - "description": "The plugin activation status.", - "type": "string", - "enum": [ - "inactive", - "active", - "network-active" - ], - "default": "inactive", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/plugins" - } - ] - }, "route": "/wp/v2/plugins" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json index e6bdc5f..b91f95f 100644 --- a/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-posts-id-autosaves.json @@ -1,267 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "excerpt": { - "description": "The excerpt for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Excerpt for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML excerpt for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the excerpt is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "featured_media": { - "description": "The ID of the featured media for the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "format": { - "description": "The format for the post.", - "type": "string", - "enum": [ - "standard", - "aside", - "chat", - "gallery", - "link", - "image", - "quote", - "status", - "video", - "audio" - ], - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "footnotes": { - "type": "string", - "description": "", - "default": "" - } - }, - "required": false - }, - "sticky": { - "description": "Whether or not the post should be treated as sticky.", - "type": "boolean", - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "categories": { - "description": "The terms assigned to the post in the category taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "tags": { - "description": "The terms assigned to the post in the post_tag taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - } - } - } - ], "route": "/wp/v2/posts/(?P[\\d]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-posts-id.json b/tests/data/rest-api/routes/wp-v2-posts-id.json index e25edd0..d04a4bd 100644 --- a/tests/data/rest-api/routes/wp-v2-posts-id.json +++ b/tests/data/rest-api/routes/wp-v2-posts-id.json @@ -1,304 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "password": { - "description": "The password for the post if it is password protected.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "excerpt": { - "description": "The excerpt for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Excerpt for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML excerpt for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the excerpt is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "featured_media": { - "description": "The ID of the featured media for the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "format": { - "description": "The format for the post.", - "type": "string", - "enum": [ - "standard", - "aside", - "chat", - "gallery", - "link", - "image", - "quote", - "status", - "video", - "audio" - ], - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "footnotes": { - "type": "string", - "description": "", - "default": "" - } - }, - "required": false - }, - "sticky": { - "description": "Whether or not the post should be treated as sticky.", - "type": "boolean", - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "categories": { - "description": "The terms assigned to the post in the category taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "tags": { - "description": "The terms assigned to the post in the post_tag taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the post.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/posts/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-posts-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-posts-parent-autosaves-id.json index c587676..5b1561c 100644 --- a/tests/data/rest-api/routes/wp-v2-posts-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-posts-parent-autosaves-id.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the autosave.", - "type": "integer", - "required": false - }, - "id": { - "description": "The ID for the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/posts/(?P[\\d]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-posts-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-posts-parent-revisions-id.json index 763c5b5..1a3d32a 100644 --- a/tests/data/rest-api/routes/wp-v2-posts-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-posts-parent-revisions-id.json @@ -1,61 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as revisions do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/posts/(?P[\\d]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-posts-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-posts-parent-revisions.json index 6d9a6c5..e37da65 100644 --- a/tests/data/rest-api/routes/wp-v2-posts-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-posts-parent-revisions.json @@ -1,99 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The ID for the parent of the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "date", - "enum": [ - "date", - "id", - "include", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - } - } - } - ], "route": "/wp/v2/posts/(?P[\\d]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-posts.json b/tests/data/rest-api/routes/wp-v2-posts.json index df5b5a5..d671c1d 100644 --- a/tests/data/rest-api/routes/wp-v2-posts.json +++ b/tests/data/rest-api/routes/wp-v2-posts.json @@ -1,607 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "after": { - "description": "Limit response to posts published after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_after": { - "description": "Limit response to posts modified after a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "author": { - "description": "Limit result set to posts assigned to specific authors.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "author_exclude": { - "description": "Ensure result set excludes posts assigned to specific authors.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "before": { - "description": "Limit response to posts published before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "modified_before": { - "description": "Limit response to posts modified before a given ISO8601 compliant date.", - "type": "string", - "format": "date-time", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by post attribute.", - "type": "string", - "default": "date", - "enum": [ - "author", - "date", - "id", - "include", - "modified", - "parent", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - }, - "search_columns": { - "default": [], - "description": "Array of column names to be searched.", - "type": "array", - "items": { - "enum": [ - "post_title", - "post_content", - "post_excerpt" - ], - "type": "string" - }, - "required": false - }, - "slug": { - "description": "Limit result set to posts with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "status": { - "default": "publish", - "description": "Limit result set to posts assigned one or more statuses.", - "type": "array", - "items": { - "enum": [ - "publish", - "future", - "draft", - "pending", - "private", - "trash", - "auto-draft", - "inherit", - "request-pending", - "request-confirmed", - "request-failed", - "request-completed", - "any" - ], - "type": "string" - }, - "required": false - }, - "tax_relation": { - "description": "Limit result set based on relationship between multiple taxonomies.", - "type": "string", - "enum": [ - "AND", - "OR" - ], - "required": false - }, - "categories": { - "description": "Limit result set to items with specific terms assigned in the categories taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - }, - "include_children": { - "description": "Whether to include child terms in the terms limiting the result set.", - "type": "boolean", - "default": false - }, - "operator": { - "description": "Whether items must be assigned all or any of the specified terms.", - "type": "string", - "enum": [ - "AND", - "OR" - ], - "default": "OR" - } - }, - "additionalProperties": false - } - ], - "required": false - }, - "categories_exclude": { - "description": "Limit result set to items except those with specific terms assigned in the categories taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - }, - "include_children": { - "description": "Whether to include child terms in the terms limiting the result set.", - "type": "boolean", - "default": false - } - }, - "additionalProperties": false - } - ], - "required": false - }, - "tags": { - "description": "Limit result set to items with specific terms assigned in the tags taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - }, - "operator": { - "description": "Whether items must be assigned all or any of the specified terms.", - "type": "string", - "enum": [ - "AND", - "OR" - ], - "default": "OR" - } - }, - "additionalProperties": false - } - ], - "required": false - }, - "tags_exclude": { - "description": "Limit result set to items except those with specific terms assigned in the tags taxonomy.", - "type": [ - "object", - "array" - ], - "oneOf": [ - { - "title": "Term ID List", - "description": "Match terms with the listed IDs.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "title": "Term ID Taxonomy Query", - "description": "Perform an advanced term query.", - "type": "object", - "properties": { - "terms": { - "description": "Term IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [] - } - }, - "additionalProperties": false - } - ], - "required": false - }, - "sticky": { - "description": "Limit result set to items that are sticky.", - "type": "boolean", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "date": { - "description": "The date the post was published, in the site's timezone.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "type": [ - "string", - "null" - ], - "format": "date-time", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string", - "required": false - }, - "status": { - "description": "A named status for the post.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "password": { - "description": "A password to protect access to the content and excerpt.", - "type": "string", - "required": false - }, - "title": { - "description": "The title for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML title for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Content for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML content for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit" - ], - "readonly": true - }, - "block_version": { - "description": "Version of the content block format used by the post.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - }, - "protected": { - "description": "Whether the content is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "author": { - "description": "The ID for the author of the post.", - "type": "integer", - "required": false - }, - "excerpt": { - "description": "The excerpt for the post.", - "type": "object", - "properties": { - "raw": { - "description": "Excerpt for the post, as it exists in the database.", - "type": "string", - "context": [ - "edit" - ] - }, - "rendered": { - "description": "HTML excerpt for the post, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - }, - "protected": { - "description": "Whether the excerpt is protected with a password.", - "type": "boolean", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "featured_media": { - "description": "The ID of the featured media for the post.", - "type": "integer", - "required": false - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "format": { - "description": "The format for the post.", - "type": "string", - "enum": [ - "standard", - "aside", - "chat", - "gallery", - "link", - "image", - "quote", - "status", - "video", - "audio" - ], - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "footnotes": { - "type": "string", - "description": "", - "default": "" - } - }, - "required": false - }, - "sticky": { - "description": "Whether or not the post should be treated as sticky.", - "type": "boolean", - "required": false - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string", - "required": false - }, - "categories": { - "description": "The terms assigned to the post in the category taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - }, - "tags": { - "description": "The terms assigned to the post in the post_tag taxonomy.", - "type": "array", - "items": { - "type": "integer" - }, - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/posts" - } - ] - }, "route": "/wp/v2/posts" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-search.json b/tests/data/rest-api/routes/wp-v2-search.json index 623ec57..1f162ef 100644 --- a/tests/data/rest-api/routes/wp-v2-search.json +++ b/tests/data/rest-api/routes/wp-v2-search.json @@ -1,98 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "type": { - "default": "post", - "description": "Limit results to items of an object type.", - "type": "string", - "enum": [ - "post", - "term", - "post-format" - ], - "required": false - }, - "subtype": { - "default": "any", - "description": "Limit results to items of one or more object subtypes.", - "type": "array", - "items": { - "enum": [ - "post", - "page", - "category", - "post_tag", - "any" - ], - "type": "string" - }, - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/search" - } - ] - }, "route": "/wp/v2/search" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-settings.json b/tests/data/rest-api/routes/wp-v2-settings.json index c0a72dd..425d4d9 100644 --- a/tests/data/rest-api/routes/wp-v2-settings.json +++ b/tests/data/rest-api/routes/wp-v2-settings.json @@ -1,132 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": [] - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "title": { - "description": "Site title.", - "type": "string", - "required": false - }, - "description": { - "description": "Site tagline.", - "type": "string", - "required": false - }, - "timezone": { - "description": "A city in the same timezone as you.", - "type": "string", - "required": false - }, - "date_format": { - "description": "A date format for all date strings.", - "type": "string", - "required": false - }, - "time_format": { - "description": "A time format for all time strings.", - "type": "string", - "required": false - }, - "start_of_week": { - "description": "A day number of the week that the week should start on.", - "type": "integer", - "required": false - }, - "language": { - "description": "WordPress locale code.", - "type": "string", - "required": false - }, - "use_smilies": { - "description": "Convert emoticons like :-) and :-P to graphics on display.", - "type": "boolean", - "required": false - }, - "default_category": { - "description": "Default post category.", - "type": "integer", - "required": false - }, - "default_post_format": { - "description": "Default post format.", - "type": "string", - "required": false - }, - "posts_per_page": { - "description": "Blog pages show at most.", - "type": "integer", - "required": false - }, - "show_on_front": { - "description": "What to show on the front page", - "type": "string", - "required": false - }, - "page_on_front": { - "description": "The ID of the page that should be displayed on the front page", - "type": "integer", - "required": false - }, - "page_for_posts": { - "description": "The ID of the page that should display the latest posts", - "type": "integer", - "required": false - }, - "default_ping_status": { - "description": "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "default_comment_status": { - "description": "Allow people to submit comments on new posts.", - "type": "string", - "enum": [ - "open", - "closed" - ], - "required": false - }, - "site_logo": { - "description": "Site logo.", - "type": "integer", - "required": false - }, - "site_icon": { - "description": "Site icon.", - "type": "integer", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/settings" - } - ] - }, "route": "/wp/v2/settings" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-sidebars-id.json b/tests/data/rest-api/routes/wp-v2-sidebars-id.json index 21a488f..dbc4771 100644 --- a/tests/data/rest-api/routes/wp-v2-sidebars-id.json +++ b/tests/data/rest-api/routes/wp-v2-sidebars-id.json @@ -1,55 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "The id of a registered sidebar", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "widgets": { - "description": "Nested widgets.", - "type": "array", - "items": { - "type": [ - "object", - "string" - ] - }, - "required": false - } - } - } - ], "route": "/wp/v2/sidebars/(?P[\\w-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-sidebars.json b/tests/data/rest-api/routes/wp-v2-sidebars.json index ee8a539..2e810ce 100644 --- a/tests/data/rest-api/routes/wp-v2-sidebars.json +++ b/tests/data/rest-api/routes/wp-v2-sidebars.json @@ -1,34 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/sidebars" - } - ] - }, "route": "/wp/v2/sidebars" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-statuses-status.json b/tests/data/rest-api/routes/wp-v2-statuses-status.json index a392c2e..ffe5ffb 100644 --- a/tests/data/rest-api/routes/wp-v2-statuses-status.json +++ b/tests/data/rest-api/routes/wp-v2-statuses-status.json @@ -1,32 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "status": { - "description": "An alphanumeric identifier for the status.", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/statuses/(?P[\\w-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-statuses.json b/tests/data/rest-api/routes/wp-v2-statuses.json index 24a1fa8..7097580 100644 --- a/tests/data/rest-api/routes/wp-v2-statuses.json +++ b/tests/data/rest-api/routes/wp-v2-statuses.json @@ -1,34 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/statuses" - } - ] - }, "route": "/wp/v2/statuses" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-tags-id.json b/tests/data/rest-api/routes/wp-v2-tags-id.json index 9c55579..8c3443e 100644 --- a/tests/data/rest-api/routes/wp-v2-tags-id.json +++ b/tests/data/rest-api/routes/wp-v2-tags-id.json @@ -1,98 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as terms do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/tags/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-tags.json b/tests/data/rest-api/routes/wp-v2-tags.json index 9f2497b..341401a 100644 --- a/tests/data/rest-api/routes/wp-v2-tags.json +++ b/tests/data/rest-api/routes/wp-v2-tags.json @@ -1,158 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "asc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by term attribute.", - "type": "string", - "default": "name", - "enum": [ - "id", - "include", - "name", - "slug", - "include_slugs", - "term_group", - "description", - "count" - ], - "required": false - }, - "hide_empty": { - "description": "Whether to hide terms not assigned to any posts.", - "type": "boolean", - "default": false, - "required": false - }, - "post": { - "description": "Limit result set to terms assigned to a specific post.", - "type": "integer", - "default": null, - "required": false - }, - "slug": { - "description": "Limit result set to terms with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": true - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/tags" - } - ] - }, "route": "/wp/v2/tags" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-taxonomies-taxonomy.json b/tests/data/rest-api/routes/wp-v2-taxonomies-taxonomy.json index e07bbe1..d7bf64f 100644 --- a/tests/data/rest-api/routes/wp-v2-taxonomies-taxonomy.json +++ b/tests/data/rest-api/routes/wp-v2-taxonomies-taxonomy.json @@ -1,32 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "taxonomy": { - "description": "An alphanumeric identifier for the taxonomy.", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/taxonomies/(?P[\\w-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-taxonomies.json b/tests/data/rest-api/routes/wp-v2-taxonomies.json index 0cbd8a8..915d121 100644 --- a/tests/data/rest-api/routes/wp-v2-taxonomies.json +++ b/tests/data/rest-api/routes/wp-v2-taxonomies.json @@ -1,39 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "type": { - "description": "Limit results to taxonomies associated with a specific post type.", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/taxonomies" - } - ] - }, "route": "/wp/v2/taxonomies" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json index 028d61e..69d3fe1 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-id-autosaves.json @@ -1,144 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "slug": { - "description": "Unique slug identifying the template.", - "type": "string", - "minLength": 1, - "pattern": "[a-zA-Z0-9_\\%-]+", - "required": false - }, - "theme": { - "description": "Theme identifier for the template.", - "type": "string", - "required": false - }, - "type": { - "description": "Type of template.", - "type": "string", - "required": false - }, - "content": { - "description": "Content of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Content for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the template.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "title": { - "description": "Title of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Title for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the template, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "description": "Description of template.", - "type": "string", - "required": false - }, - "status": { - "description": "Status of template.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "author": { - "description": "The ID for the author of the template.", - "type": "integer", - "required": false - }, - "area": { - "description": "Where the template part is intended for use (header, footer, etc.)", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-id.json b/tests/data/rest-api/routes/wp-v2-template-parts-id.json index 02c6d1e..a0f4742 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-id.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-id.json @@ -1,167 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "slug": { - "description": "Unique slug identifying the template.", - "type": "string", - "minLength": 1, - "pattern": "[a-zA-Z0-9_\\%-]+", - "required": false - }, - "theme": { - "description": "Theme identifier for the template.", - "type": "string", - "required": false - }, - "type": { - "description": "Type of template.", - "type": "string", - "required": false - }, - "content": { - "description": "Content of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Content for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the template.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "title": { - "description": "Title of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Title for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the template, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "description": "Description of template.", - "type": "string", - "required": false - }, - "status": { - "description": "Status of template.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "author": { - "description": "The ID for the author of the template.", - "type": "integer", - "required": false - }, - "area": { - "description": "Where the template part is intended for use (header, footer, etc.)", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-lookup.json b/tests/data/rest-api/routes/wp-v2-template-parts-lookup.json index 566caa5..fa30479 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-lookup.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-lookup.json @@ -1,38 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "slug": { - "description": "The slug of the template to get the fallback for", - "type": "string", - "required": true - }, - "is_custom": { - "description": "Indicates if a template is custom or part of the template hierarchy", - "type": "boolean", - "required": false - }, - "template_prefix": { - "description": "The template prefix for the created template. This is used to extract the main template type, e.g. in `taxonomy-books` extracts the `taxonomy`", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/template-parts/lookup" - } - ] - }, "route": "/wp/v2/template-parts/lookup" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json index 4bfa07c..bfa7170 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-autosaves-id.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "id": { - "description": "The ID for the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json index 6c1c090..be964f3 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions-id.json @@ -1,61 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as revisions do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json index 9ad956e..38dc3e6 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts-parent-revisions.json @@ -1,99 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "date", - "enum": [ - "date", - "id", - "include", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - } - } - } - ], "route": "/wp/v2/template-parts/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-template-parts.json b/tests/data/rest-api/routes/wp-v2-template-parts.json index aa2464a..80061eb 100644 --- a/tests/data/rest-api/routes/wp-v2-template-parts.json +++ b/tests/data/rest-api/routes/wp-v2-template-parts.json @@ -1,160 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "wp_id": { - "description": "Limit to the specified post id.", - "type": "integer", - "required": false - }, - "area": { - "description": "Limit to the specified template part area.", - "type": "string", - "required": false - }, - "post_type": { - "description": "Post type to get the templates for.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "slug": { - "description": "Unique slug identifying the template.", - "type": "string", - "minLength": 1, - "pattern": "[a-zA-Z0-9_\\%-]+", - "required": true - }, - "theme": { - "description": "Theme identifier for the template.", - "type": "string", - "required": false - }, - "type": { - "description": "Type of template.", - "type": "string", - "required": false - }, - "content": { - "default": "", - "description": "Content of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Content for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the template.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "title": { - "default": "", - "description": "Title of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Title for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the template, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "default": "", - "description": "Description of template.", - "type": "string", - "required": false - }, - "status": { - "default": "publish", - "description": "Status of template.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "author": { - "description": "The ID for the author of the template.", - "type": "integer", - "required": false - }, - "area": { - "description": "Where the template part is intended for use (header, footer, etc.)", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/template-parts" - } - ] - }, "route": "/wp/v2/template-parts" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json index 7cba606..80eede4 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json +++ b/tests/data/rest-api/routes/wp-v2-templates-id-autosaves.json @@ -1,139 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "slug": { - "description": "Unique slug identifying the template.", - "type": "string", - "minLength": 1, - "pattern": "[a-zA-Z0-9_\\%-]+", - "required": false - }, - "theme": { - "description": "Theme identifier for the template.", - "type": "string", - "required": false - }, - "type": { - "description": "Type of template.", - "type": "string", - "required": false - }, - "content": { - "description": "Content of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Content for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the template.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "title": { - "description": "Title of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Title for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the template, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "description": "Description of template.", - "type": "string", - "required": false - }, - "status": { - "description": "Status of template.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "author": { - "description": "The ID for the author of the template.", - "type": "integer", - "required": false - } - } - } - ], "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-id.json b/tests/data/rest-api/routes/wp-v2-templates-id.json index 10c55bb..ae85136 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-id.json +++ b/tests/data/rest-api/routes/wp-v2-templates-id.json @@ -1,162 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "slug": { - "description": "Unique slug identifying the template.", - "type": "string", - "minLength": 1, - "pattern": "[a-zA-Z0-9_\\%-]+", - "required": false - }, - "theme": { - "description": "Theme identifier for the template.", - "type": "string", - "required": false - }, - "type": { - "description": "Type of template.", - "type": "string", - "required": false - }, - "content": { - "description": "Content of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Content for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the template.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "title": { - "description": "Title of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Title for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the template, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "description": "Description of template.", - "type": "string", - "required": false - }, - "status": { - "description": "Status of template.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "author": { - "description": "The ID for the author of the template.", - "type": "integer", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "id": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Whether to bypass Trash and force deletion.", - "required": false - } - } - } - ], "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-lookup.json b/tests/data/rest-api/routes/wp-v2-templates-lookup.json index 930e8ab..afc60fb 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-lookup.json +++ b/tests/data/rest-api/routes/wp-v2-templates-lookup.json @@ -1,38 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "slug": { - "description": "The slug of the template to get the fallback for", - "type": "string", - "required": true - }, - "is_custom": { - "description": "Indicates if a template is custom or part of the template hierarchy", - "type": "boolean", - "required": false - }, - "template_prefix": { - "description": "The template prefix for the created template. This is used to extract the main template type, e.g. in `taxonomy-books` extracts the `taxonomy`", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/templates/lookup" - } - ] - }, "route": "/wp/v2/templates/lookup" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json index 4f1be42..8e093a0 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-autosaves-id.json @@ -1,37 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "id": { - "description": "The ID for the autosave.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/autosaves/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json index 69aa509..bb9958b 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions-id.json @@ -1,61 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "id": { - "description": "Unique identifier for the revision.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as revisions do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json index 14e573a..f43a72c 100644 --- a/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json +++ b/tests/data/rest-api/routes/wp-v2-templates-parent-revisions.json @@ -1,99 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "parent": { - "description": "The id of a template", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "desc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by object attribute.", - "type": "string", - "default": "date", - "enum": [ - "date", - "id", - "include", - "relevance", - "slug", - "include_slugs", - "title" - ], - "required": false - } - } - } - ], "route": "/wp/v2/templates/(?P([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w%-]+)/revisions" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-templates.json b/tests/data/rest-api/routes/wp-v2-templates.json index 7eb21e3..5ecb243 100644 --- a/tests/data/rest-api/routes/wp-v2-templates.json +++ b/tests/data/rest-api/routes/wp-v2-templates.json @@ -1,155 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "wp_id": { - "description": "Limit to the specified post id.", - "type": "integer", - "required": false - }, - "area": { - "description": "Limit to the specified template part area.", - "type": "string", - "required": false - }, - "post_type": { - "description": "Post type to get the templates for.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "slug": { - "description": "Unique slug identifying the template.", - "type": "string", - "minLength": 1, - "pattern": "[a-zA-Z0-9_\\%-]+", - "required": true - }, - "theme": { - "description": "Theme identifier for the template.", - "type": "string", - "required": false - }, - "type": { - "description": "Type of template.", - "type": "string", - "required": false - }, - "content": { - "default": "", - "description": "Content of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Content for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit" - ] - }, - "block_version": { - "description": "Version of the content block format used by the template.", - "type": "integer", - "context": [ - "edit" - ], - "readonly": true - } - }, - "required": false - }, - "title": { - "default": "", - "description": "Title of template.", - "type": [ - "object", - "string" - ], - "properties": { - "raw": { - "description": "Title for the template, as it exists in the database.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ] - }, - "rendered": { - "description": "HTML title for the template, transformed for display.", - "type": "string", - "context": [ - "view", - "edit", - "embed" - ], - "readonly": true - } - }, - "required": false - }, - "description": { - "default": "", - "description": "Description of template.", - "type": "string", - "required": false - }, - "status": { - "default": "publish", - "description": "Status of template.", - "type": "string", - "enum": [ - "publish", - "future", - "draft", - "pending", - "private" - ], - "required": false - }, - "author": { - "description": "The ID for the author of the template.", - "type": "integer", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/templates" - } - ] - }, "route": "/wp/v2/templates" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-themes-stylesheet.json b/tests/data/rest-api/routes/wp-v2-themes-stylesheet.json index 42646e9..987724f 100644 --- a/tests/data/rest-api/routes/wp-v2-themes-stylesheet.json +++ b/tests/data/rest-api/routes/wp-v2-themes-stylesheet.json @@ -1,21 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "stylesheet": { - "description": "The theme's stylesheet. This uniquely identifies the theme.", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/themes/(?P[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-themes.json b/tests/data/rest-api/routes/wp-v2-themes.json index 54a601c..1e15aed 100644 --- a/tests/data/rest-api/routes/wp-v2-themes.json +++ b/tests/data/rest-api/routes/wp-v2-themes.json @@ -1,35 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "status": { - "description": "Limit result set to themes assigned one or more statuses.", - "type": "array", - "items": { - "enum": [ - "active", - "inactive" - ], - "type": "string" - }, - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/themes" - } - ] - }, "route": "/wp/v2/themes" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-types-type.json b/tests/data/rest-api/routes/wp-v2-types-type.json index 6df843f..ec9fe4e 100644 --- a/tests/data/rest-api/routes/wp-v2-types-type.json +++ b/tests/data/rest-api/routes/wp-v2-types-type.json @@ -1,32 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "type": { - "description": "An alphanumeric identifier for the post type.", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/types/(?P[\\w-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-types.json b/tests/data/rest-api/routes/wp-v2-types.json index dab7498..6e08349 100644 --- a/tests/data/rest-api/routes/wp-v2-types.json +++ b/tests/data/rest-api/routes/wp-v2-types.json @@ -1,34 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/types" - } - ] - }, "route": "/wp/v2/types" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-users-id.json b/tests/data/rest-api/routes/wp-v2-users-id.json index 705581b..affe286 100644 --- a/tests/data/rest-api/routes/wp-v2-users-id.json +++ b/tests/data/rest-api/routes/wp-v2-users-id.json @@ -1,170 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "Unique identifier for the user.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "id": { - "description": "Unique identifier for the user.", - "type": "integer", - "required": false - }, - "username": { - "description": "Login name for the user.", - "type": "string", - "required": false - }, - "name": { - "description": "Display name for the user.", - "type": "string", - "required": false - }, - "first_name": { - "description": "First name for the user.", - "type": "string", - "required": false - }, - "last_name": { - "description": "Last name for the user.", - "type": "string", - "required": false - }, - "email": { - "description": "The email address for the user.", - "type": "string", - "format": "email", - "required": false - }, - "url": { - "description": "URL of the user.", - "type": "string", - "format": "uri", - "required": false - }, - "description": { - "description": "Description of the user.", - "type": "string", - "required": false - }, - "locale": { - "description": "Locale for the user.", - "type": "string", - "enum": [ - "", - "en_US", - "ar", - "de_DE", - "he_IL", - "it_IT" - ], - "required": false - }, - "nickname": { - "description": "The nickname for the user.", - "type": "string", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the user.", - "type": "string", - "required": false - }, - "roles": { - "description": "Roles assigned to the user.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "password": { - "description": "Password for the user (never included).", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "persisted_preferences": { - "type": "object", - "description": "", - "default": [], - "context": [ - "edit" - ], - "properties": { - "_modified": { - "description": "The date and time the preferences were updated.", - "type": "string", - "format": "date-time", - "readonly": false - } - }, - "additionalProperties": true - } - }, - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "id": { - "description": "Unique identifier for the user.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as users do not support trashing.", - "required": false - }, - "reassign": { - "type": "integer", - "description": "Reassign the deleted user's posts and links to this user ID.", - "required": true - } - } - } - ], "route": "/wp/v2/users/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-users-me.json b/tests/data/rest-api/routes/wp-v2-users-me.json index 118df34..be45c65 100644 --- a/tests/data/rest-api/routes/wp-v2-users-me.json +++ b/tests/data/rest-api/routes/wp-v2-users-me.json @@ -1,162 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "username": { - "description": "Login name for the user.", - "type": "string", - "required": false - }, - "name": { - "description": "Display name for the user.", - "type": "string", - "required": false - }, - "first_name": { - "description": "First name for the user.", - "type": "string", - "required": false - }, - "last_name": { - "description": "Last name for the user.", - "type": "string", - "required": false - }, - "email": { - "description": "The email address for the user.", - "type": "string", - "format": "email", - "required": false - }, - "url": { - "description": "URL of the user.", - "type": "string", - "format": "uri", - "required": false - }, - "description": { - "description": "Description of the user.", - "type": "string", - "required": false - }, - "locale": { - "description": "Locale for the user.", - "type": "string", - "enum": [ - "", - "en_US", - "ar", - "de_DE", - "he_IL", - "it_IT" - ], - "required": false - }, - "nickname": { - "description": "The nickname for the user.", - "type": "string", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the user.", - "type": "string", - "required": false - }, - "roles": { - "description": "Roles assigned to the user.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "password": { - "description": "Password for the user (never included).", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "persisted_preferences": { - "type": "object", - "description": "", - "default": [], - "context": [ - "edit" - ], - "properties": { - "_modified": { - "description": "The date and time the preferences were updated.", - "type": "string", - "format": "date-time", - "readonly": false - } - }, - "additionalProperties": true - } - }, - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": { - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as users do not support trashing.", - "required": false - }, - "reassign": { - "type": "integer", - "description": "Reassign the deleted user's posts and links to this user ID.", - "required": true - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/users/me" - } - ] - }, "route": "/wp/v2/users/me" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-introspect.json b/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-introspect.json index 2ccb7d9..dba3f5f 100644 --- a/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-introspect.json +++ b/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-introspect.json @@ -1,27 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/users/(?P(?:[\\d]+|me))/application-passwords/introspect" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-uuid.json b/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-uuid.json index d48c20d..f975c6f 100644 --- a/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-uuid.json +++ b/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords-uuid.json @@ -1,59 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "args": { - "app_id": { - "description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.", - "type": "string", - "format": "uuid", - "required": false - }, - "name": { - "description": "The name of the application password.", - "type": "string", - "minLength": 1, - "pattern": ".*\\S.*", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": [] - } - ], "route": "/wp/v2/users/(?P(?:[\\d]+|me))/application-passwords/(?P[\\w\\-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords.json b/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords.json index 4591d89..af31e3a 100644 --- a/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords.json +++ b/tests/data/rest-api/routes/wp-v2-users-user-id-me-application-passwords.json @@ -1,55 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "app_id": { - "description": "A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.", - "type": "string", - "format": "uuid", - "required": false - }, - "name": { - "description": "The name of the application password.", - "type": "string", - "minLength": 1, - "pattern": ".*\\S.*", - "required": true - } - } - }, - { - "methods": [ - "DELETE" - ], - "args": [] - } - ], "route": "/wp/v2/users/(?P(?:[\\d]+|me))/application-passwords" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-users.json b/tests/data/rest-api/routes/wp-v2-users.json index baba96e..0c25389 100644 --- a/tests/data/rest-api/routes/wp-v2-users.json +++ b/tests/data/rest-api/routes/wp-v2-users.json @@ -1,261 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "default": "asc", - "description": "Order sort attribute ascending or descending.", - "enum": [ - "asc", - "desc" - ], - "type": "string", - "required": false - }, - "orderby": { - "default": "name", - "description": "Sort collection by user attribute.", - "enum": [ - "id", - "include", - "name", - "registered_date", - "slug", - "include_slugs", - "email", - "url" - ], - "type": "string", - "required": false - }, - "slug": { - "description": "Limit result set to users with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "roles": { - "description": "Limit result set to users matching at least one specific role provided. Accepts csv list or single role.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "capabilities": { - "description": "Limit result set to users matching at least one specific capability provided. Accepts csv list or single capability.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "who": { - "description": "Limit result set to users who are considered authors.", - "type": "string", - "enum": [ - "authors" - ], - "required": false - }, - "has_published_posts": { - "description": "Limit result set to users who have published posts.", - "type": [ - "boolean", - "array" - ], - "items": { - "type": "string", - "enum": { - "post": "post", - "page": "page", - "attachment": "attachment", - "nav_menu_item": "nav_menu_item", - "wp_block": "wp_block", - "wp_template": "wp_template", - "wp_template_part": "wp_template_part", - "wp_navigation": "wp_navigation" - } - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "args": { - "username": { - "description": "Login name for the user.", - "type": "string", - "required": true - }, - "name": { - "description": "Display name for the user.", - "type": "string", - "required": false - }, - "first_name": { - "description": "First name for the user.", - "type": "string", - "required": false - }, - "last_name": { - "description": "Last name for the user.", - "type": "string", - "required": false - }, - "email": { - "description": "The email address for the user.", - "type": "string", - "format": "email", - "required": true - }, - "url": { - "description": "URL of the user.", - "type": "string", - "format": "uri", - "required": false - }, - "description": { - "description": "Description of the user.", - "type": "string", - "required": false - }, - "locale": { - "description": "Locale for the user.", - "type": "string", - "enum": [ - "", - "en_US", - "ar", - "de_DE", - "he_IL", - "it_IT" - ], - "required": false - }, - "nickname": { - "description": "The nickname for the user.", - "type": "string", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the user.", - "type": "string", - "required": false - }, - "roles": { - "description": "Roles assigned to the user.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - }, - "password": { - "description": "Password for the user (never included).", - "type": "string", - "required": true - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": { - "persisted_preferences": { - "type": "object", - "description": "", - "default": [], - "context": [ - "edit" - ], - "properties": { - "_modified": { - "description": "The date and time the preferences were updated.", - "type": "string", - "format": "date-time", - "readonly": false - } - }, - "additionalProperties": true - } - }, - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/users" - } - ] - }, "route": "/wp/v2/users" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-widget-types-id-encode.json b/tests/data/rest-api/routes/wp-v2-widget-types-id-encode.json index 695ab37..78eb1a4 100644 --- a/tests/data/rest-api/routes/wp-v2-widget-types-id-encode.json +++ b/tests/data/rest-api/routes/wp-v2-widget-types-id-encode.json @@ -1,31 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "POST" - ], - "endpoints": [ - { - "methods": [ - "POST" - ], - "args": { - "id": { - "description": "The widget type id.", - "type": "string", - "required": true - }, - "instance": { - "description": "Current instance settings of the widget.", - "type": "object", - "required": false - }, - "form_data": { - "description": "Serialized widget form data to encode into instance settings.", - "type": "string", - "required": false - } - } - } - ], "route": "/wp/v2/widget-types/(?P[a-zA-Z0-9_-]+)/encode" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-widget-types-id-render.json b/tests/data/rest-api/routes/wp-v2-widget-types-id-render.json index 6844a77..582772f 100644 --- a/tests/data/rest-api/routes/wp-v2-widget-types-id-render.json +++ b/tests/data/rest-api/routes/wp-v2-widget-types-id-render.json @@ -1,26 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "POST" - ], - "endpoints": [ - { - "methods": [ - "POST" - ], - "args": { - "id": { - "description": "The widget type id.", - "type": "string", - "required": true - }, - "instance": { - "description": "Current instance settings of the widget.", - "type": "object", - "required": false - } - } - } - ], "route": "/wp/v2/widget-types/(?P[a-zA-Z0-9_-]+)/render" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-widget-types-id.json b/tests/data/rest-api/routes/wp-v2-widget-types-id.json index 6dd9739..2f4b986 100644 --- a/tests/data/rest-api/routes/wp-v2-widget-types-id.json +++ b/tests/data/rest-api/routes/wp-v2-widget-types-id.json @@ -1,32 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "id": { - "description": "The widget type id.", - "type": "string", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], "route": "/wp/v2/widget-types/(?P[a-zA-Z0-9_-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-widget-types.json b/tests/data/rest-api/routes/wp-v2-widget-types.json index ead8a65..30be2a9 100644 --- a/tests/data/rest-api/routes/wp-v2-widget-types.json +++ b/tests/data/rest-api/routes/wp-v2-widget-types.json @@ -1,34 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/widget-types" - } - ] - }, "route": "/wp/v2/widget-types" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-widgets-id.json b/tests/data/rest-api/routes/wp-v2-widgets-id.json index 1ed90f8..543a062 100644 --- a/tests/data/rest-api/routes/wp-v2-widgets-id.json +++ b/tests/data/rest-api/routes/wp-v2-widgets-id.json @@ -1,109 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the widget.", - "type": "string", - "required": false - }, - "id_base": { - "description": "The type of the widget. Corresponds to ID in widget-types endpoint.", - "type": "string", - "required": false - }, - "sidebar": { - "description": "The sidebar the widget belongs to.", - "type": "string", - "required": false - }, - "instance": { - "description": "Instance settings of the widget, if supported.", - "type": "object", - "properties": { - "encoded": { - "description": "Base64 encoded representation of the instance settings.", - "type": "string", - "context": [ - "edit" - ] - }, - "hash": { - "description": "Cryptographic hash of the instance settings.", - "type": "string", - "context": [ - "edit" - ] - }, - "raw": { - "description": "Unencoded instance settings, if supported.", - "type": "object", - "context": [ - "edit" - ] - } - }, - "required": false - }, - "form_data": { - "description": "URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "force": { - "description": "Whether to force removal of the widget, or move it to the inactive sidebar.", - "type": "boolean", - "required": false - } - } - } - ], "route": "/wp/v2/widgets/(?P[\\w\\-]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-widgets.json b/tests/data/rest-api/routes/wp-v2-widgets.json index ee4cd2b..189eef4 100644 --- a/tests/data/rest-api/routes/wp-v2-widgets.json +++ b/tests/data/rest-api/routes/wp-v2-widgets.json @@ -1,102 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "sidebar": { - "description": "The sidebar to return widgets for.", - "type": "string", - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the widget.", - "type": "string", - "required": false - }, - "id_base": { - "description": "The type of the widget. Corresponds to ID in widget-types endpoint.", - "type": "string", - "required": false - }, - "sidebar": { - "default": "wp_inactive_widgets", - "description": "The sidebar the widget belongs to.", - "type": "string", - "required": true - }, - "instance": { - "description": "Instance settings of the widget, if supported.", - "type": "object", - "properties": { - "encoded": { - "description": "Base64 encoded representation of the instance settings.", - "type": "string", - "context": [ - "edit" - ] - }, - "hash": { - "description": "Cryptographic hash of the instance settings.", - "type": "string", - "context": [ - "edit" - ] - }, - "raw": { - "description": "Unencoded instance settings, if supported.", - "type": "object", - "context": [ - "edit" - ] - } - }, - "required": false - }, - "form_data": { - "description": "URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only.", - "type": "string", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/widgets" - } - ] - }, "route": "/wp/v2/widgets" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json b/tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json index 6de3f87..0965a07 100644 --- a/tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json +++ b/tests/data/rest-api/routes/wp-v2-wp-pattern-category-id.json @@ -1,98 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - } - } - }, - { - "methods": [ - "POST", - "PUT", - "PATCH" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": false - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - }, - { - "methods": [ - "DELETE" - ], - "allow_batch": { - "v1": true - }, - "args": { - "id": { - "description": "Unique identifier for the term.", - "type": "integer", - "required": false - }, - "force": { - "type": "boolean", - "default": false, - "description": "Required to be true, as terms do not support trashing.", - "required": false - } - } - } - ], "route": "/wp/v2/wp_pattern_category/(?P[\\d]+)" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-wp-pattern-category.json b/tests/data/rest-api/routes/wp-v2-wp-pattern-category.json index a2affe8..f56ff6e 100644 --- a/tests/data/rest-api/routes/wp-v2-wp-pattern-category.json +++ b/tests/data/rest-api/routes/wp-v2-wp-pattern-category.json @@ -1,158 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET", - "POST" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "allow_batch": { - "v1": true - }, - "args": { - "context": { - "description": "Scope under which the request is made; determines fields present in response.", - "type": "string", - "enum": [ - "view", - "embed", - "edit" - ], - "default": "view", - "required": false - }, - "page": { - "description": "Current page of the collection.", - "type": "integer", - "default": 1, - "minimum": 1, - "required": false - }, - "per_page": { - "description": "Maximum number of items to be returned in result set.", - "type": "integer", - "default": 10, - "minimum": 1, - "maximum": 100, - "required": false - }, - "search": { - "description": "Limit results to those matching a string.", - "type": "string", - "required": false - }, - "exclude": { - "description": "Ensure result set excludes specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "include": { - "description": "Limit result set to specific IDs.", - "type": "array", - "items": { - "type": "integer" - }, - "default": [], - "required": false - }, - "offset": { - "description": "Offset the result set by a specific number of items.", - "type": "integer", - "required": false - }, - "order": { - "description": "Order sort attribute ascending or descending.", - "type": "string", - "default": "asc", - "enum": [ - "asc", - "desc" - ], - "required": false - }, - "orderby": { - "description": "Sort collection by term attribute.", - "type": "string", - "default": "name", - "enum": [ - "id", - "include", - "name", - "slug", - "include_slugs", - "term_group", - "description", - "count" - ], - "required": false - }, - "hide_empty": { - "description": "Whether to hide terms not assigned to any posts.", - "type": "boolean", - "default": false, - "required": false - }, - "post": { - "description": "Limit result set to terms assigned to a specific post.", - "type": "integer", - "default": null, - "required": false - }, - "slug": { - "description": "Limit result set to terms with one or more specific slugs.", - "type": "array", - "items": { - "type": "string" - }, - "required": false - } - } - }, - { - "methods": [ - "POST" - ], - "allow_batch": { - "v1": true - }, - "args": { - "description": { - "description": "HTML description of the term.", - "type": "string", - "required": false - }, - "name": { - "description": "HTML title for the term.", - "type": "string", - "required": true - }, - "slug": { - "description": "An alphanumeric identifier for the term unique to its type.", - "type": "string", - "required": false - }, - "meta": { - "description": "Meta fields.", - "type": "object", - "properties": [], - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2/wp_pattern_category" - } - ] - }, "route": "/wp/v2/wp_pattern_category" } \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2.json b/tests/data/rest-api/routes/wp-v2.json index f7dcc1f..e09bcde 100644 --- a/tests/data/rest-api/routes/wp-v2.json +++ b/tests/data/rest-api/routes/wp-v2.json @@ -1,31 +1,3 @@ { - "namespace": "wp/v2", - "methods": [ - "GET" - ], - "endpoints": [ - { - "methods": [ - "GET" - ], - "args": { - "namespace": { - "default": "wp/v2", - "required": false - }, - "context": { - "default": "view", - "required": false - } - } - } - ], - "_links": { - "self": [ - { - "href": "http://example.org/wp-json/wp/v2" - } - ] - }, "route": "/wp/v2" } \ No newline at end of file diff --git a/tests/output/routes.php b/tests/output/routes.php index 7a8a028..7426bc2 100644 --- a/tests/output/routes.php +++ b/tests/output/routes.php @@ -26,7 +26,11 @@ $i = preg_replace( '#\-+#', '-', $i ); $i = trim( $i, '-' ); - $json = json_encode( $item, JSON_PRETTY_PRINT ^ JSON_UNESCAPED_SLASHES ); + $save = [ + 'route' => $item['route'], + ]; + + $json = json_encode( $save, JSON_PRETTY_PRINT ^ JSON_UNESCAPED_SLASHES ); file_put_contents( $dir . '/' . $i . '.json', $json ); } From e3ed4cb66ed47328819a9f28430326adfd4a63e0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 9 Mar 2024 13:24:24 +0000 Subject: [PATCH 45/62] 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 46/62] 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 47/62] 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 48/62] 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 49/62] 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": [ From 28640299df23b8c0466d08fcca0b01b2456960d3 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 2 Apr 2024 23:09:36 +0200 Subject: [PATCH 50/62] 3.65.0 --- package.json | 2 +- packages/wp-types/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8e3b4d7..e2bf967 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-json-schemas", - "version": "3.64.0", + "version": "3.65.0", "description": "JSON schemas for WordPress PHP objects and REST API responses", "main": "schema.json", "files": [ diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index 9b2ae37..7722873 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -1,6 +1,6 @@ { "name": "wp-types", - "version": "3.64.0", + "version": "3.65.0", "description": "TypeScript definitions of WordPress PHP objects and REST API responses.", "main": "", "types": "index.ts", From 14cbf741f351a937106354348eb7a1aa7ea6cbaf Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 11 Jul 2024 23:15:31 +0200 Subject: [PATCH 51/62] Add some docs about core-data. --- packages/wp-types/readme.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 1d54a02..2b4af22 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -286,6 +286,22 @@ import { WP_Post_Type_Name } from 'wp-types'; console.log( WP_Post_Type_Name.auto_draft ); ``` +### How are these definitions different to `@wordpress/core-data`? + +[The `@wordpress/core-data` package](https://www.npmjs.com/package/@wordpress/core-data) includes TypeScript definitions for some WordPress data types. These packages don't "compete", they can be complimentary, and there are advantages and disadvantages to using one over the other depending on your use case. + +#### Advantages of `wp-types` + +* `wp-types` contains definitions for *all* WordPress REST API endpoints and data types, whereas `@wordpress/core-data` includes only the data types used by the core data store +* `wp-types` is automatically tested against each new version of WordPress, whereas `@wordpress/core-data` is not and the can get out of date +* `@wordpress/core-data` is a full data store implementation library, not just the type definitions + +#### Advantages of `@wordpress/core-data` + +* `@wordpress/core-data` includes separate type definitions for the `view`, `edit`, and `embed` contexts, whereas `wp-types` includes only the combined `view` and `edit` contexts (although this will hopefully change in the future) +* `@wordpress/core-data` includes separate type definitions for the different data structure that needs to be sent to some endpoints for POST and PUT requests, whereas `wp-types` does not (although this will also hopefully change in the future) +* If you're already using the `@wordpress/core-data` API in a TypeScript project and you don't need type definitions for anything beyond the core data store, then there is no need to use `wp-types` + ## License MIT From 851ae3159d2d86cf88c5921496001ddf58e032a5 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 11 Jul 2024 23:19:40 +0200 Subject: [PATCH 52/62] Only copy the SQLite driver when starting the tests. --- composer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index aba8c77..1e0263d 100644 --- a/composer.json +++ b/composer.json @@ -50,10 +50,9 @@ "wordpress-install-dir": "tests/wordpress" }, "scripts": { - "post-update-cmd": [ - "@php -r \"file_exists( 'tests/wordpress/wp-content/db.php' ) || copy( 'tests/wordpress/wp-content/plugins/sqlite-database-integration/db.copy', 'tests/wordpress/wp-content/db.php' );\"" - ], "test": [ + "@php -r \"file_exists( 'tests/wordpress/wp-content/db.php' ) || copy( 'tests/wordpress/wp-content/plugins/sqlite-database-integration/db.copy', 'tests/wordpress/wp-content/db.php' );\"", + "npm run validate", "npm run build-wp-types", "npm run test-wp-types", From 8d7063d65840cff39c895bb5bde31423c5d18846 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 12 Jul 2024 16:24:03 +0200 Subject: [PATCH 53/62] Add schemas for WordPress 6.6. --- composer.json | 2 +- packages/wp-types/index.ts | 43 ++++++++++++++ schemas/properties/post-type-labels.json | 3 + schemas/properties/taxonomy-labels.json | 4 ++ schemas/rest-api/attachment.json | 9 +++ schemas/rest-api/block.json | 27 +++++++++ schemas/rest-api/post.json | 9 +++ schemas/rest-api/type.json | 57 +++++++++++++++++++ tests/data/rest-api/routes/routes.json | 4 ++ .../routes/wp-v2-book-id-autosaves.json | 3 + tests/data/rest-api/routes/wp-v2-book-id.json | 3 + .../wp-v2-book-parent-autosaves-id.json | 3 + tests/data/rest-api/routes/wp-v2-book.json | 3 + tests/mu-plugins/mu-plugin.php | 17 ++++++ 14 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 tests/data/rest-api/routes/wp-v2-book-id-autosaves.json create mode 100644 tests/data/rest-api/routes/wp-v2-book-id.json create mode 100644 tests/data/rest-api/routes/wp-v2-book-parent-autosaves-id.json create mode 100644 tests/data/rest-api/routes/wp-v2-book.json diff --git a/composer.json b/composer.json index 1e0263d..0ebe16a 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.5.0", + "roots/wordpress-full": "6.6-RC3", "wp-cli/core-command": "^2", "wp-cli/db-command": "^2", "wp-cli/language-command": "^2", diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 2519a27..b123a82 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -984,6 +984,7 @@ export interface WP_Post_Type_Labels { item_link_description: string; menu_name: string; name_admin_bar: string; + template_name?: string; } /** * Post type capabilities. @@ -1723,6 +1724,7 @@ export interface WP_Taxonomy_Labels { item_link_description: string; menu_name: string; name_admin_bar: string; + template_name: string; } /** * Taxonomy capabilities. @@ -1957,6 +1959,10 @@ export interface WP_REST_API_Post { * A field used for ordering posts. */ menu_order?: number; + /** + * An array of the class names for the post container element. + */ + class_list: string[]; /** * The title for the post. */ @@ -2202,6 +2208,10 @@ export interface WP_REST_API_Attachment { * Slug automatically generated from the attachment title. Only present when using the 'edit' context and the post type is public. */ generated_slug?: string; + /** + * An array of the class names for the post container element. + */ + class_list: string[]; /** * The title for the attachment. */ @@ -2339,6 +2349,23 @@ export interface WP_REST_API_Block { */ protected: boolean; }; + /** + * The excerpt for the block. + */ + excerpt?: { + /** + * Excerpt for the block, as it exists in the database. Only present when using the 'edit' context. + */ + raw?: string; + /** + * HTML content for the post excerpt, transformed for display. + */ + rendered: string; + /** + * Whether the content is protected with a password. + */ + protected: boolean; + }; wp_pattern_sync_status: "" | "partial" | "unsynced"; /** * Pattern categories. @@ -3279,6 +3306,22 @@ export interface WP_REST_API_Type { * REST route's namespace for the post type. */ rest_namespace: string; + /** + * The block template associated with the post type. + */ + template?: ( + | [string] + | [ + string, + { + [k: string]: unknown; + }, + ] + )[]; + /** + * The template lock associated with the post type, or false if none. + */ + template_lock?: "all" | "insert" | false; /** * The visibility settings for the post type. Only present when using the 'edit' context. */ diff --git a/schemas/properties/post-type-labels.json b/schemas/properties/post-type-labels.json index 0afa819..14b366b 100644 --- a/schemas/properties/post-type-labels.json +++ b/schemas/properties/post-type-labels.json @@ -149,6 +149,9 @@ }, "name_admin_bar": { "type": "string" + }, + "template_name": { + "type": "string" } }, "additionalProperties": false diff --git a/schemas/properties/taxonomy-labels.json b/schemas/properties/taxonomy-labels.json index b02f71f..1c4da20 100644 --- a/schemas/properties/taxonomy-labels.json +++ b/schemas/properties/taxonomy-labels.json @@ -33,6 +33,7 @@ "back_to_items", "item_link", "item_link_description", + "template_name", "menu_name", "name_admin_bar" ], @@ -162,6 +163,9 @@ }, "name_admin_bar": { "type": "string" + }, + "template_name": { + "type": "string" } }, "additionalProperties": false diff --git a/schemas/rest-api/attachment.json b/schemas/rest-api/attachment.json index 14f5746..a8e2c04 100644 --- a/schemas/rest-api/attachment.json +++ b/schemas/rest-api/attachment.json @@ -16,6 +16,7 @@ "slug", "status", "type", + "class_list", "title", "author", "template", @@ -222,6 +223,14 @@ "description": "Slug automatically generated from the attachment title. Only present when using the 'edit' context and the post type is public.", "type": "string" }, + "class_list": { + "readOnly": true, + "description": "An array of the class names for the post container element.", + "type": "array", + "items": { + "type": "string" + } + }, "title": { "description": "The title for the attachment.", "type": "object", diff --git a/schemas/rest-api/block.json b/schemas/rest-api/block.json index 67bc176..19be0a7 100644 --- a/schemas/rest-api/block.json +++ b/schemas/rest-api/block.json @@ -153,6 +153,33 @@ }, "additionalProperties": false }, + "excerpt": { + "description": "The excerpt for the block.", + "type": "object", + "required": [ + "rendered", + "protected" + ], + "properties": { + "raw": { + "description": "Excerpt for the block, as it exists in the database. Only present when using the 'edit' context.", + "contentMediaType": "text/html", + "type": "string" + }, + "rendered": { + "readOnly": true, + "description": "HTML content for the post excerpt, transformed for display.", + "contentMediaType": "text/html", + "type": "string" + }, + "protected": { + "readOnly": true, + "description": "Whether the content is protected with a password.", + "type": "boolean" + } + }, + "additionalProperties": false + }, "wp_pattern_sync_status": { "type": "string", "enum": [ diff --git a/schemas/rest-api/post.json b/schemas/rest-api/post.json index 010d2f3..9da7e14 100644 --- a/schemas/rest-api/post.json +++ b/schemas/rest-api/post.json @@ -15,6 +15,7 @@ "slug", "status", "type", + "class_list", "title", "content", "author", @@ -144,6 +145,14 @@ "description": "A field used for ordering posts.", "type": "integer" }, + "class_list": { + "readOnly": true, + "description": "An array of the class names for the post container element.", + "type": "array", + "items": { + "type": "string" + } + }, "title": { "description": "The title for the post.", "type": "object", diff --git a/schemas/rest-api/type.json b/schemas/rest-api/type.json index 6b0ac80..3cb374c 100644 --- a/schemas/rest-api/type.json +++ b/schemas/rest-api/type.json @@ -98,6 +98,63 @@ "description": "REST route's namespace for the post type.", "type": "string" }, + "template": { + "description": "The block template associated with the post type.", + "examples": [ + [ + [ + "core/image" + ] + ], + [ + [ + "core/image" + ], + [ + "core/paragraph", + { + "placeholder": "Image Details" + } + ] + ] + ], + "type": "array", + "items": { + "oneOf": [ + { + "type": "array", + "items": [ + { + "type": "string" + } + ], + "minItems": 1, + "maxItems": 1 + }, + { + "type": "array", + "items": [ + { + "type": "string" + }, + { + "type": "object" + } + ], + "minItems": 2, + "maxItems": 2 + } + ] + } + }, + "template_lock": { + "description": "The template lock associated with the post type, or false if none.", + "enum": [ + "all", + "insert", + false + ] + }, "visibility": { "description": "The visibility settings for the post type. Only present when using the 'edit' context.", "type": "object", diff --git a/tests/data/rest-api/routes/routes.json b/tests/data/rest-api/routes/routes.json index 30e6705..3e2a40f 100644 --- a/tests/data/rest-api/routes/routes.json +++ b/tests/data/rest-api/routes/routes.json @@ -13,6 +13,10 @@ "/wp/v2/blocks/(?P[\\d]+)/autosaves/(?P[\\d]+)", "/wp/v2/blocks/(?P[\\d]+)/revisions", "/wp/v2/blocks/(?P[\\d]+)/revisions/(?P[\\d]+)", + "/wp/v2/book", + "/wp/v2/book/(?P[\\d]+)", + "/wp/v2/book/(?P[\\d]+)/autosaves", + "/wp/v2/book/(?P[\\d]+)/autosaves/(?P[\\d]+)", "/wp/v2/categories", "/wp/v2/categories/(?P[\\d]+)", "/wp/v2/comments", diff --git a/tests/data/rest-api/routes/wp-v2-book-id-autosaves.json b/tests/data/rest-api/routes/wp-v2-book-id-autosaves.json new file mode 100644 index 0000000..a4a7d2a --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-book-id-autosaves.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/book/(?P[\\d]+)/autosaves" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-book-id.json b/tests/data/rest-api/routes/wp-v2-book-id.json new file mode 100644 index 0000000..77affbb --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-book-id.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/book/(?P[\\d]+)" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-book-parent-autosaves-id.json b/tests/data/rest-api/routes/wp-v2-book-parent-autosaves-id.json new file mode 100644 index 0000000..7b48d0f --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-book-parent-autosaves-id.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/book/(?P[\\d]+)/autosaves/(?P[\\d]+)" +} \ No newline at end of file diff --git a/tests/data/rest-api/routes/wp-v2-book.json b/tests/data/rest-api/routes/wp-v2-book.json new file mode 100644 index 0000000..880253a --- /dev/null +++ b/tests/data/rest-api/routes/wp-v2-book.json @@ -0,0 +1,3 @@ +{ + "route": "/wp/v2/book" +} \ No newline at end of file diff --git a/tests/mu-plugins/mu-plugin.php b/tests/mu-plugins/mu-plugin.php index c7be522..9cb2e23 100644 --- a/tests/mu-plugins/mu-plugin.php +++ b/tests/mu-plugins/mu-plugin.php @@ -33,6 +33,23 @@ // Ensure we're authenticated as an admin during test data generation. grant_super_admin( 1 ); wp_set_current_user( 1 ); + + register_post_type( 'book', [ + 'public' => true, + 'label' => 'Books', + 'show_in_rest' => true, + 'template' => [ + [ + 'core/paragraph', + [ + 'placeholder' => 'Add a description of the book', + ], + ], + [ + 'core/paragraph', + ], + ], + ] ); } ); /** From 3ac3b610c3c0fb4b201303e7cf75e1ec76069b28 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 13 Jul 2024 14:08:44 +0200 Subject: [PATCH 54/62] 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 2b4af22..9e01fa0 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.5. +The definitions were last updated for WordPress 6.6. ## 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. `65` for WordPress 6.5 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `66` for WordPress 6.6 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.65.0` - Schema version 3 for WordPress 6.5 +* `~3.66.0` - Schema version 3 for WordPress 6.6 * `~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 2bdd24b..50671f3 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.5. +The schemas were last updated for WordPress 6.6. ## 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. `65` for WordPress 6.5 +* The minor version number (`y`) indicates the WordPress branch version number without its decimal place, eg. `66` for WordPress 6.6 * The patch version number (`z`) indicates the schema patch version number Examples: -* `~3.65.0` - Schema version 3 for WordPress 6.5 +* `~3.66.0` - Schema version 3 for WordPress 6.6 * `~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 8b3750c3ac8b830a27901a063b6f3bc6850e489e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 13 Jul 2024 15:33:10 +0200 Subject: [PATCH 55/62] Add a schema for the font collections REST API endpoints. --- packages/wp-types/index.ts | 106 +++++++++ packages/wp-types/readme.md | 4 +- readme.md | 4 +- schema.json | 8 + .../collections/font-collections.json | 19 ++ schemas/rest-api/font-collection.json | 221 ++++++++++++++++++ tests/external-schemas/font-collection.json | 159 +++++++++++++ tests/output/font-collection.php | 17 ++ 8 files changed, 534 insertions(+), 4 deletions(-) create mode 100644 schemas/rest-api/collections/font-collections.json create mode 100644 schemas/rest-api/font-collection.json create mode 100644 tests/external-schemas/font-collection.json create mode 100644 tests/output/font-collection.php diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index b123a82..74c89ec 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -36,6 +36,10 @@ export type WP_REST_API_Date_Time = string; * A collection of comment objects in a REST API context. */ export type WP_REST_API_Comments = WP_REST_API_Comment[]; +/** + * A collection of font collection objects in a REST API context. + */ +export type WP_REST_API_Font_Collections = WP_REST_API_Font_Collection[]; /** * A collection of post objects in a REST API context. */ @@ -138,6 +142,8 @@ export interface WP { REST_API: { Comment: WP_REST_API_Comment; Comments: WP_REST_API_Comments; + Font_Collection: WP_REST_API_Font_Collection; + Font_Collections: WP_REST_API_Font_Collections; Post: WP_REST_API_Post; Posts: WP_REST_API_Posts; Page: WP_REST_API_Page; @@ -1886,6 +1892,106 @@ export interface WP_REST_API_Object_Links { [k: string]: unknown; }[]; } +/** + * A font collection object in a REST API context. + */ +export interface WP_REST_API_Font_Collection { + /** + * Unique identifier for the font collection. + */ + slug: string; + /** + * The name for the font collection. + */ + name: string; + /** + * The description for the font collection. + */ + description: string; + /** + * The font families for the font collection. + */ + font_families: { + font_family_settings: { + name: string; + fontFamily: string; + slug: string; + fontFace?: { + /** + * URL to a preview image of the font. + */ + preview?: string; + /** + * CSS font-family value. + */ + fontFamily: string; + /** + * CSS font-style value. + */ + fontStyle?: string; + /** + * List of available font weights, separated by a space. + */ + fontWeight?: string | number; + /** + * CSS font-display value. + */ + fontDisplay?: "auto" | "block" | "fallback" | "swap" | "optional"; + /** + * Paths or URLs to the font files. + */ + src: string | string[]; + /** + * CSS font-stretch value. + */ + fontStretch?: string; + /** + * CSS ascent-override value. + */ + ascentOverride?: string; + /** + * CSS descent-override value. + */ + descentOverride?: string; + /** + * CSS font-variant value. + */ + fontVariant?: string; + /** + * CSS font-feature-settings value. + */ + fontFeatureSettings?: string; + /** + * CSS font-variation-settings value. + */ + fontVariationSettings?: string; + /** + * CSS line-gap-override value. + */ + lineGapOverride?: string; + /** + * CSS size-adjust value. + */ + sizeAdjust?: string; + /** + * CSS unicode-range value. + */ + unicodeRange?: string; + }[]; + preview?: string; + }; + categories?: string[]; + }[]; + /** + * The categories for the font collection. + */ + categories: { + name: string; + slug: string; + }[]; + _links: WP_REST_API_Object_Links; + [k: string]: unknown; +} /** * A post object in a REST API context. */ diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 9e01fa0..89e6ce8 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -52,8 +52,8 @@ 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-collections | `WP_REST_API_Font_Collections` +/wp/v2/wp/v2/font-collections/{slug} | `WP_REST_API_Font_Collection` /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 diff --git a/readme.md b/readme.md index 50671f3..7a7eb2d 100644 --- a/readme.md +++ b/readme.md @@ -56,8 +56,8 @@ 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-collections | `WP_REST_API_Font_Collections` +/wp/v2/wp/v2/font-collections/{slug} | `WP_REST_API_Font_Collection` /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 diff --git a/schema.json b/schema.json index 49c6896..e8b19f7 100644 --- a/schema.json +++ b/schema.json @@ -80,6 +80,12 @@ "Comments": { "$ref": "schemas/rest-api/collections/comments.json" }, + "Font_Collection": { + "$ref": "schemas/rest-api/font-collection.json" + }, + "Font_Collections": { + "$ref": "schemas/rest-api/collections/font-collections.json" + }, "Post": { "$ref": "schemas/rest-api/post.json" }, @@ -201,6 +207,8 @@ "required": [ "Comment", "Comments", + "Font_Collection", + "Font_Collections", "Post", "Posts", "Page", diff --git a/schemas/rest-api/collections/font-collections.json b/schemas/rest-api/collections/font-collections.json new file mode 100644 index 0000000..a865fc1 --- /dev/null +++ b/schemas/rest-api/collections/font-collections.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/font-collections.json", + "title": "WP_REST_API_Font_Collections", + "description": "A collection of font collection objects in a REST API context.", + "type": "array", + "items": { + "$ref": "../font-collection.json" + }, + "links": [ + { + "rel": "self", + "href": "/wp/v2/font-collections", + "targetSchema": { + "$ref": "#" + } + } + ] +} diff --git a/schemas/rest-api/font-collection.json b/schemas/rest-api/font-collection.json new file mode 100644 index 0000000..9f97fc7 --- /dev/null +++ b/schemas/rest-api/font-collection.json @@ -0,0 +1,221 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/font-collection.json", + "title": "WP_REST_API_Font_Collection", + "description": "A font collection object in a REST API context.", + "$comment": "See also https://schemas.wp.org/trunk/font-collection.json", + "type": "object", + "readOnly": true, + "required": [ + "slug", + "name", + "description", + "font_families", + "categories", + "_links" + ], + "properties": { + "slug": { + "description": "Unique identifier for the font collection.", + "type": "string" + }, + "name": { + "description": "The name for the font collection.", + "type": "string" + }, + "description": { + "description": "The description for the font collection.", + "type": "string" + }, + "font_families": { + "description": "The font families for the font collection.", + "type": "array", + "items": { + "type": "object", + "required": [ + "font_family_settings" + ], + "properties": { + "font_family_settings": { + "type": "object", + "required": [ + "name", + "fontFamily", + "slug" + ], + "properties": { + "name": { + "type": "string" + }, + "fontFamily": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "fontFace": { + "type": "array", + "items": { + "type": "object", + "required": [ + "src", + "fontFamily" + ], + "properties": { + "preview": { + "description": "URL to a preview image of the font.", + "type": "string", + "format": "uri" + }, + "fontFamily": { + "description": "CSS font-family value.", + "type": "string" + }, + "fontStyle": { + "description": "CSS font-style value.", + "type": "string" + }, + "fontWeight": { + "description": "List of available font weights, separated by a space.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "fontDisplay": { + "description": "CSS font-display value.", + "type": "string", + "enum": [ + "auto", + "block", + "fallback", + "swap", + "optional" + ] + }, + "src": { + "description": "Paths or URLs to the font files.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "fontStretch": { + "description": "CSS font-stretch value.", + "type": "string" + }, + "ascentOverride": { + "description": "CSS ascent-override value.", + "type": "string" + }, + "descentOverride": { + "description": "CSS descent-override value.", + "type": "string" + }, + "fontVariant": { + "description": "CSS font-variant value.", + "type": "string" + }, + "fontFeatureSettings": { + "description": "CSS font-feature-settings value.", + "type": "string" + }, + "fontVariationSettings": { + "description": "CSS font-variation-settings value.", + "type": "string" + }, + "lineGapOverride": { + "description": "CSS line-gap-override value.", + "type": "string" + }, + "sizeAdjust": { + "description": "CSS size-adjust value.", + "type": "string" + }, + "unicodeRange": { + "description": "CSS unicode-range value.", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "preview": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false + }, + "categories": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "categories": { + "description": "The categories for the font collection.", + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "slug" + ], + "properties": { + "name": { + "type": "string" + }, + "slug": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "_links": { + "$ref": "properties/object-links.json" + } + }, + "links": [ + { + "rel": "self", + "href": "/wp/v2/font-collections/{slug}", + "hrefSchema": { + "properties": { + "slug": { + "$ref": "#/properties/slug" + } + } + }, + "targetSchema": { + "$ref": "#" + } + }, + { + "rel": "collection", + "href": "/wp/v2/font-collections", + "targetSchema": { + "type": "array", + "items": { + "$ref": "#" + } + } + } + ] +} diff --git a/tests/external-schemas/font-collection.json b/tests/external-schemas/font-collection.json new file mode 100644 index 0000000..e52455b --- /dev/null +++ b/tests/external-schemas/font-collection.json @@ -0,0 +1,159 @@ +{ + "title": "JSON schema for WordPress Font Collections", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "definitions": { + "fontFace": { + "description": "Font face settings, with added preview property.", + "type": "object", + "properties": { + "preview": { + "description": "URL to a preview image of the font.", + "type": "string" + }, + "fontFamily": { + "description": "CSS font-family value.", + "type": "string", + "default": "" + }, + "fontStyle": { + "description": "CSS font-style value.", + "type": "string", + "default": "normal" + }, + "fontWeight": { + "description": "List of available font weights, separated by a space.", + "default": "400", + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "fontDisplay": { + "description": "CSS font-display value.", + "type": "string", + "default": "fallback", + "enum": [ "auto", "block", "fallback", "swap", "optional" ] + }, + "src": { + "description": "Paths or URLs to the font files.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "default": [] + }, + "fontStretch": { + "description": "CSS font-stretch value.", + "type": "string" + }, + "ascentOverride": { + "description": "CSS ascent-override value.", + "type": "string" + }, + "descentOverride": { + "description": "CSS descent-override value.", + "type": "string" + }, + "fontVariant": { + "description": "CSS font-variant value.", + "type": "string" + }, + "fontFeatureSettings": { + "description": "CSS font-feature-settings value.", + "type": "string" + }, + "fontVariationSettings": { + "description": "CSS font-variation-settings value.", + "type": "string" + }, + "lineGapOverride": { + "description": "CSS line-gap-override value.", + "type": "string" + }, + "sizeAdjust": { + "description": "CSS size-adjust value.", + "type": "string" + }, + "unicodeRange": { + "description": "CSS unicode-range value.", + "type": "string" + } + }, + "required": [ "fontFamily", "src" ], + "additionalProperties": false + } + }, + "properties": { + "$schema": { + "description": "JSON schema URI for font-collection.json.", + "type": "string" + }, + "font_families": { + "type": "array", + "description": "Array of font families ready to be installed.", + "items": { + "type": "object", + "properties": { + "font_family_settings": { + "description": "Font family settings, with added preview property.", + "type": "object", + "properties": { + "name": { + "description": "Name of the font family preset, translatable.", + "type": "string" + }, + "slug": { + "description": "Kebab-case unique identifier for the font family preset.", + "type": "string" + }, + "fontFamily": { + "description": "CSS font-family value.", + "type": "string" + }, + "preview": { + "type": "string", + "description": "URL to a preview image of the font family." + }, + "fontFace": { + "description": "Array of font-face definitions.", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "#/definitions/fontFace" + } + ] + } + } + }, + "required": [ "name", "fontFamily", "slug" ], + "additionalProperties": false + }, + "categories": { + "type": "array", + "description": "Array of category slugs.", + "items": { + "type": "string" + } + } + }, + "required": [ "font_family_settings" ], + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": [ "font_families" ] +} diff --git a/tests/output/font-collection.php b/tests/output/font-collection.php new file mode 100644 index 0000000..254d1f5 --- /dev/null +++ b/tests/output/font-collection.php @@ -0,0 +1,17 @@ + Date: Sat, 13 Jul 2024 15:42:34 +0200 Subject: [PATCH 56/62] Move the hyper-schema. --- .gitignore | 1 - package.json | 3 +- tests/bin/test.sh | 2 +- .../hyper-schema.json | 0 tests/hyper-schema/index.ts | 231 ------------------ 5 files changed, 2 insertions(+), 235 deletions(-) rename tests/{hyper-schema => external-schemas}/hyper-schema.json (100%) delete mode 100644 tests/hyper-schema/index.ts diff --git a/.gitignore b/.gitignore index ff2d5b5..16c9195 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ /composer.lock /package-lock.json -/tests/hyper-schema/index.js diff --git a/package.json b/package.json index e2bf967..e6250a6 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,7 @@ "scripts": { "version": "cd packages/wp-types && npm version $(node -p -e \"require('../../package.json').version\") && git add .", "build-wp-types": "json2ts -i schema.json -o packages/wp-types/index.ts --style.trailingComma=all --style.useTabs && cat packages/wp-types/append.ts >> packages/wp-types/index.ts", - "build-hyper-schema-types": "json2ts -i tests/hyper-schema/hyper-schema.json -o tests/hyper-schema/index.ts --style.trailingComma=all --style.useTabs", "test-wp-types": "tsc packages/wp-types/tests/test.ts --noEmit --strict", - "validate": "ajv compile --strict --strict-schema=false -c ajv-formats -m tests/hyper-schema/hyper-schema.json -s schema.json -r \"schemas/**/*.json\"" + "validate": "ajv compile --strict --strict-schema=false -c ajv-formats -m tests/external-schemas/hyper-schema.json -s schema.json -r \"schemas/**/*.json\"" } } diff --git a/tests/bin/test.sh b/tests/bin/test.sh index 12115d6..3b6331f 100755 --- a/tests/bin/test.sh +++ b/tests/bin/test.sh @@ -15,7 +15,7 @@ function validate_schema() { local filename=${base/.json/} ls tests/data/$filename/*.json > /dev/null - ./node_modules/.bin/ajv validate --strict --strict-schema=false -c ajv-formats -m tests/hyper-schema/hyper-schema.json -r schema.json -r $rflag -s "$file" -d "tests/data/$filename/*.json" + ./node_modules/.bin/ajv validate --strict --strict-schema=false -c ajv-formats -m tests/external-schemas/hyper-schema.json -r schema.json -r $rflag -s "$file" -d "tests/data/$filename/*.json" } IGNORE_FILES=("schemas/rest-api/error.json" "schemas/rest-api/category.json" "schemas/rest-api/tag.json" "schemas/rest-api/page.json") diff --git a/tests/hyper-schema/hyper-schema.json b/tests/external-schemas/hyper-schema.json similarity index 100% rename from tests/hyper-schema/hyper-schema.json rename to tests/external-schemas/hyper-schema.json diff --git a/tests/hyper-schema/index.ts b/tests/hyper-schema/index.ts deleted file mode 100644 index 60ca80d..0000000 --- a/tests/hyper-schema/index.ts +++ /dev/null @@ -1,231 +0,0 @@ -/* eslint-disable */ -/** - * This file was automatically generated by json-schema-to-typescript. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run json-schema-to-typescript to regenerate this file. - */ - -export type JSONHyperSchema = JSONHyperSchema1 & JSONHyperSchema2; -export type JSONHyperSchema1 = CoreSchemaMetaSchema; -export type CoreSchemaMetaSchema = - | { - $id?: string; - $schema?: string; - $ref?: string; - $comment?: string; - title?: string; - description?: string; - default?: true; - readOnly?: boolean; - writeOnly?: boolean; - examples?: true[]; - multipleOf?: number; - maximum?: number; - exclusiveMaximum?: number; - minimum?: number; - exclusiveMinimum?: number; - maxLength?: number; - minLength?: number; - pattern?: string; - additionalItems?: CoreSchemaMetaSchema; - items?: CoreSchemaMetaSchema | [CoreSchemaMetaSchema, ...CoreSchemaMetaSchema[]]; - maxItems?: number; - minItems?: number; - uniqueItems?: boolean; - contains?: CoreSchemaMetaSchema; - maxProperties?: number; - minProperties?: number; - required?: string[]; - additionalProperties?: CoreSchemaMetaSchema; - definitions?: { - [k: string]: CoreSchemaMetaSchema; - }; - properties?: { - [k: string]: CoreSchemaMetaSchema; - }; - patternProperties?: { - [k: string]: CoreSchemaMetaSchema; - }; - dependencies?: { - [k: string]: CoreSchemaMetaSchema | string[]; - }; - propertyNames?: CoreSchemaMetaSchema; - const?: true; - enum?: [true, ...unknown[]]; - type?: - | ("array" | "boolean" | "integer" | "null" | "number" | "object" | "string") - | [ - "array" | "boolean" | "integer" | "null" | "number" | "object" | "string", - ...("array" | "boolean" | "integer" | "null" | "number" | "object" | "string")[] - ]; - format?: string; - contentMediaType?: string; - contentEncoding?: string; - if?: CoreSchemaMetaSchema; - then?: CoreSchemaMetaSchema; - else?: CoreSchemaMetaSchema; - allOf?: [CoreSchemaMetaSchema, ...CoreSchemaMetaSchema[]]; - anyOf?: [CoreSchemaMetaSchema, ...CoreSchemaMetaSchema[]]; - oneOf?: [CoreSchemaMetaSchema, ...CoreSchemaMetaSchema[]]; - not?: CoreSchemaMetaSchema; - [k: string]: unknown; - } - | boolean; -export type SchemaArray = JSONHyperSchema1[]; -/** - * JSON Schema describing the link target - */ -export type JSONHyperSchema3 = JSONHyperSchema4 & JSONHyperSchema5; -export type JSONHyperSchema4 = CoreSchemaMetaSchema; -/** - * Schema describing the data to submit along with the request - */ -export type JSONHyperSchema6 = JSONHyperSchema7 & JSONHyperSchema8; -export type JSONHyperSchema7 = CoreSchemaMetaSchema; - -export interface JSONHyperSchema2 { - additionalItems?: boolean | JSONHyperSchema1; - additionalProperties?: boolean | JSONHyperSchema1; - dependencies?: { - [k: string]: JSONHyperSchema1 | unknown[]; - }; - items?: JSONHyperSchema1 | SchemaArray; - definitions?: { - [k: string]: JSONHyperSchema1; - }; - patternProperties?: { - [k: string]: JSONHyperSchema1; - }; - properties?: { - [k: string]: JSONHyperSchema1; - }; - allOf?: SchemaArray; - anyOf?: SchemaArray; - oneOf?: SchemaArray; - not?: JSONHyperSchema1; - links?: LinkDescriptionObject[]; - fragmentResolution?: string; - media?: { - /** - * A media type, as described in RFC 2046 - */ - type?: string; - /** - * A content encoding scheme, as described in RFC 2045 - */ - binaryEncoding?: string; - [k: string]: unknown; - }; - /** - * Instances' URIs must start with this value for this schema to apply to them - */ - pathStart?: string; - [k: string]: unknown; -} -export interface LinkDescriptionObject { - /** - * a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing - */ - href: string; - /** - * relation to the target resource of the link - */ - rel: string; - /** - * a title for the link - */ - title?: string; - targetSchema?: JSONHyperSchema3; - /** - * media type (as defined by RFC 2046) describing the link target - */ - mediaType?: string; - /** - * method for requesting the target of the link (e.g. for HTTP this might be "GET" or "DELETE") - */ - method?: string; - /** - * The media type in which to submit data along with the request - */ - encType?: string; - schema?: JSONHyperSchema6; - [k: string]: unknown; -} -export interface JSONHyperSchema5 { - additionalItems?: boolean | JSONHyperSchema1; - additionalProperties?: boolean | JSONHyperSchema1; - dependencies?: { - [k: string]: JSONHyperSchema1 | unknown[]; - }; - items?: JSONHyperSchema1 | SchemaArray; - definitions?: { - [k: string]: JSONHyperSchema1; - }; - patternProperties?: { - [k: string]: JSONHyperSchema1; - }; - properties?: { - [k: string]: JSONHyperSchema1; - }; - allOf?: SchemaArray; - anyOf?: SchemaArray; - oneOf?: SchemaArray; - not?: JSONHyperSchema1; - links?: LinkDescriptionObject[]; - fragmentResolution?: string; - media?: { - /** - * A media type, as described in RFC 2046 - */ - type?: string; - /** - * A content encoding scheme, as described in RFC 2045 - */ - binaryEncoding?: string; - [k: string]: unknown; - }; - /** - * Instances' URIs must start with this value for this schema to apply to them - */ - pathStart?: string; - [k: string]: unknown; -} -export interface JSONHyperSchema8 { - additionalItems?: boolean | JSONHyperSchema1; - additionalProperties?: boolean | JSONHyperSchema1; - dependencies?: { - [k: string]: JSONHyperSchema1 | unknown[]; - }; - items?: JSONHyperSchema1 | SchemaArray; - definitions?: { - [k: string]: JSONHyperSchema1; - }; - patternProperties?: { - [k: string]: JSONHyperSchema1; - }; - properties?: { - [k: string]: JSONHyperSchema1; - }; - allOf?: SchemaArray; - anyOf?: SchemaArray; - oneOf?: SchemaArray; - not?: JSONHyperSchema1; - links?: LinkDescriptionObject[]; - fragmentResolution?: string; - media?: { - /** - * A media type, as described in RFC 2046 - */ - type?: string; - /** - * A content encoding scheme, as described in RFC 2045 - */ - binaryEncoding?: string; - [k: string]: unknown; - }; - /** - * Instances' URIs must start with this value for this schema to apply to them - */ - pathStart?: string; - [k: string]: unknown; -} From 2f0154dc8ca99a81072cc9bedfeab739ce7e5dca Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 13 Jul 2024 18:48:23 +0200 Subject: [PATCH 57/62] Make this reusable. --- tests/mu-plugins/mu-plugin.php | 15 +++++++++++++++ tests/output/font-collection.php | 11 ++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/mu-plugins/mu-plugin.php b/tests/mu-plugins/mu-plugin.php index 9cb2e23..70c20b3 100644 --- a/tests/mu-plugins/mu-plugin.php +++ b/tests/mu-plugins/mu-plugin.php @@ -104,6 +104,21 @@ function save_rest_array( array $data, string $dir ) : void { } } +function save_external_schema( string $url, string $name ) : void { + $target = dirname( ABSPATH ) . "/external-schemas/{$name}.json"; + $schema = download_url( $url ); + + if ( is_wp_error( $schema ) ) { + throw new \Exception( "Failed to download external {$name} schema." ); + } + + $renamed = rename( $schema, $target ); + + if ( ! $renamed ) { + throw new \Exception( "Failed to rename external {$name} schema." ); + } +} + /** * Helper function for performing an internal REST API request and returning its response data. * diff --git a/tests/output/font-collection.php b/tests/output/font-collection.php index 254d1f5..8c1c558 100644 --- a/tests/output/font-collection.php +++ b/tests/output/font-collection.php @@ -8,10 +8,7 @@ $data, ], 'font-collections' ); -$font_collection_schema = download_url( 'https://schemas.wp.org/trunk/font-collection.json' ); - -if ( is_wp_error( $font_collection_schema ) ) { - throw new \Exception( 'Failed to download font-collection schema.' ); -} - -rename( $font_collection_schema, dirname( ABSPATH ) . '/external-schemas/font-collection.json' ); +save_external_schema( + 'https://schemas.wp.org/trunk/font-collection.json', + 'font-collection' +); From cac943982355ce4c6ccdd8d88d0ac1ee7459bee0 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 13 Jul 2024 18:48:43 +0200 Subject: [PATCH 58/62] Docs. --- CONTRIBUTING.md | 4 ++-- packages/wp-types/readme.md | 12 ++++++------ readme.md | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15c452e..17cdfdd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,7 +45,7 @@ The WordPress REST API response doesn't fully adhere to the JSON schema spec, so - Start by copying an existing file such as `post.php` which is for `/wp/v2/posts` - The command should perform one or more REST API requests to the endpoint and pass the responses to the `save_rest_array()` function which saves them as JSON during the tests * Run `composer run test` to validate and test the schemas. -* Run `npm run build-wp-types` and check the output of `packages/wp-types/index.ts`. +* Check the output of `packages/wp-types/index.ts`. * Add documentation for the schema in both `readme.md` and `packages/wp-types/readme.md`. ## Creating a PHP object schema @@ -69,7 +69,7 @@ The schema for a PHP object is created using the docblocks from its class proper - Start by copying an existing file such as `error.php` - The file should pass an array of one or more objects of this type to the `save_object_array()` function which saves it as JSON during the tests * Run `composer run test` to validate and test the schemas. -* Run `npm run build-wp-types` and check the output of `packages/wp-types/index.ts`. +* Check the output of `packages/wp-types/index.ts`. * Add documentation for the schema in both `readme.md` and `packages/wp-types/readme.md`. ## Updating schemas for a new WordPress release diff --git a/packages/wp-types/readme.md b/packages/wp-types/readme.md index 89e6ce8..7321812 100644 --- a/packages/wp-types/readme.md +++ b/packages/wp-types/readme.md @@ -52,12 +52,12 @@ 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 | `WP_REST_API_Font_Collections` -/wp/v2/wp/v2/font-collections/{slug} | `WP_REST_API_Font_Collection` -/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/font-collections | `WP_REST_API_Font_Collections` +/wp/v2/font-collections/{slug} | `WP_REST_API_Font_Collection` +/wp/v2/font-families | `WP_REST_API_Font_Families` +/wp/v2/font-families/{id}/ | `WP_REST_API_Font_Family` +/wp/v2/font-families/{parent}/font-faces | `WP_REST_API_Font_Faces` +/wp/v2/font-families/{parent}/font-faces/{id} | `WP_REST_API_Font_Face` /wp/v2/global-styles/{id} | Todo /wp/v2/global-styles/{parent}/revisions | Todo /wp/v2/global-styles/{parent}/revisions/{id} | Todo diff --git a/readme.md b/readme.md index 7a7eb2d..2c8217a 100644 --- a/readme.md +++ b/readme.md @@ -56,12 +56,12 @@ 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 | `WP_REST_API_Font_Collections` -/wp/v2/wp/v2/font-collections/{slug} | `WP_REST_API_Font_Collection` -/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/font-collections | `WP_REST_API_Font_Collections` +/wp/v2/font-collections/{slug} | `WP_REST_API_Font_Collection` +/wp/v2/font-families | `WP_REST_API_Font_Families` +/wp/v2/font-families/{id}/ | `WP_REST_API_Font_Family` +/wp/v2/font-families/{parent}/font-faces | `WP_REST_API_Font_Faces` +/wp/v2/font-families/{parent}/font-faces/{id} | `WP_REST_API_Font_Face` /wp/v2/global-styles/{id} | Todo /wp/v2/global-styles/{parent}/revisions | Todo /wp/v2/global-styles/{parent}/revisions/{id} | Todo From 2bd2a2cfd77db42232e34079c6043b42321c9961 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 13 Jul 2024 18:50:13 +0200 Subject: [PATCH 59/62] Add a schema for the font families REST API endpoints. --- schema.json | 8 ++ .../rest-api/collections/font-families.json | 19 +++++ schemas/rest-api/font-family.json | 81 +++++++++++++++++++ tests/output/fonts.php | 55 +++++++++++++ 4 files changed, 163 insertions(+) create mode 100644 schemas/rest-api/collections/font-families.json create mode 100644 schemas/rest-api/font-family.json create mode 100644 tests/output/fonts.php diff --git a/schema.json b/schema.json index e8b19f7..52a2de3 100644 --- a/schema.json +++ b/schema.json @@ -86,6 +86,12 @@ "Font_Collections": { "$ref": "schemas/rest-api/collections/font-collections.json" }, + "Font_Family": { + "$ref": "schemas/rest-api/font-family.json" + }, + "Font_Families": { + "$ref": "schemas/rest-api/collections/font-families.json" + }, "Post": { "$ref": "schemas/rest-api/post.json" }, @@ -209,6 +215,8 @@ "Comments", "Font_Collection", "Font_Collections", + "Font_Family", + "Font_Families", "Post", "Posts", "Page", diff --git a/schemas/rest-api/collections/font-families.json b/schemas/rest-api/collections/font-families.json new file mode 100644 index 0000000..7a1a895 --- /dev/null +++ b/schemas/rest-api/collections/font-families.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/font-families.json", + "title": "WP_REST_API_Font_Families", + "description": "A collection of font family objects in a REST API context.", + "type": "array", + "items": { + "$ref": "../font-family.json" + }, + "links": [ + { + "rel": "self", + "href": "/wp/v2/font-families", + "targetSchema": { + "$ref": "#" + } + } + ] +} diff --git a/schemas/rest-api/font-family.json b/schemas/rest-api/font-family.json new file mode 100644 index 0000000..7e9893c --- /dev/null +++ b/schemas/rest-api/font-family.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/font-family.json", + "title": "WP_REST_API_Font_Family", + "description": "A font family object in a REST API context.", + "$comment": "See also https://schemas.wp.org/trunk/font-family.json", + "type": "object", + "required": [ + "id", + "theme_json_version", + "font_faces", + "font_family_settings", + "_links" + ], + "properties": { + "id": { + "readOnly": true, + "description": "Unique identifier for the font family.", + "type": "integer" + }, + "theme_json_version": { + "description": "Version of the theme.json schema used for the typography settings.", + "type": "integer" + }, + "font_faces": { + "description": "The IDs of the child font faces in the font family.", + "type": "array", + "items": { + "type": "integer" + } + }, + "font_family_settings": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "fontFamily": { + "type": "string" + }, + "preview": { + "type": "string", + "format": "uri" + } + } + }, + "_links": { + "$ref": "properties/object-links.json" + } + }, + "links": [ + { + "rel": "self", + "href": "/wp/v2/font-families/{id}", + "hrefSchema": { + "properties": { + "id": { + "$ref": "#/properties/id" + } + } + }, + "targetSchema": { + "$ref": "#" + } + }, + { + "rel": "collection", + "href": "/wp/v2/font-families", + "targetSchema": { + "type": "array", + "items": { + "$ref": "#" + } + } + } + ], + "additionalProperties": false +} diff --git a/tests/output/fonts.php b/tests/output/fonts.php new file mode 100644 index 0000000..dce4736 --- /dev/null +++ b/tests/output/fonts.php @@ -0,0 +1,55 @@ + 'Chakra Petch', + 'fontFamily' => '"Chakra Petch", sans-serif', + 'slug' => 'chakra-petch', + 'preview' => 'https://s.w.org/images/fonts/17.7/previews/chakra-petch/chakra-petch.svg', +]; +$family_response = get_rest_response( + 'POST', + '/wp/v2/font-families', + [ + 'font_family_settings' => json_encode( $family_payload ), + ] +); +$family_id = $family_response->data['id']; + +// Add a font face to the font family: +$face_payload = [ + 'src' => content_url( 'uploads/fonts/example.woff2' ), + 'fontWeight' => '600', + 'fontStyle' => 'normal', + 'fontFamily' => 'Chakra Petch', + 'preview' => 'https://s.w.org/images/fonts/17.7/previews/chakra-petch/chakra-petch-600-normal.svg', +]; +$face_response = get_rest_response( + 'POST', + "/wp/v2/font-families/{$family_id}/font-faces", + [ + 'font_face_settings' => json_encode( $face_payload ), + ] +); +$face_id = $face_response->data['id']; + +// Get the font families: +$data = get_rest_response( 'GET', '/wp/v2/font-families' ); + +save_rest_array( [ + $data, +], 'font-families' ); + +// Get the faces for the font family: +$data = get_rest_response( 'GET', "/wp/v2/font-families/{$family_id}/font-faces" ); + +save_rest_array( [ + $data, +], 'font-faces' ); + +save_external_schema( + 'https://schemas.wp.org/trunk/theme.json', + 'font-family' +); From cee61be6dd0ca8dd5e2e7c5ffa622222aec68aa3 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 14 Jul 2024 17:52:08 +0200 Subject: [PATCH 60/62] Introduce schemas for font families and font faces. --- composer.json | 1 + packages/wp-types/index.ts | 107 +++++++++++++++ schema.json | 8 ++ schemas/rest-api/collections/font-faces.json | 10 ++ schemas/rest-api/font-collection.json | 8 +- schemas/rest-api/font-face.json | 136 +++++++++++++++++++ schemas/rest-api/font-family.json | 13 +- tests/external-schemas/font-collection.json | 29 +++- tests/external-schemas/font-face.json | 95 +++++++++++++ tests/mu-plugins/mu-plugin.php | 41 +++++- tests/output/fonts.php | 6 +- 11 files changed, 437 insertions(+), 17 deletions(-) create mode 100644 schemas/rest-api/collections/font-faces.json create mode 100644 schemas/rest-api/font-face.json create mode 100644 tests/external-schemas/font-face.json diff --git a/composer.json b/composer.json index 0ebe16a..3985824 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "require-dev": { "ext-sqlite3": "*", "ext-pdo_sqlite": "*", + "ergebnis/json-printer": "^3.5", "johnbillion/args": "1.7.0", "roots/wordpress-core-installer": "^1.0.0", "roots/wordpress-full": "6.6-RC3", diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 74c89ec..3cc8c36 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -40,6 +40,14 @@ export type WP_REST_API_Comments = WP_REST_API_Comment[]; * A collection of font collection objects in a REST API context. */ export type WP_REST_API_Font_Collections = WP_REST_API_Font_Collection[]; +/** + * A collection of font family objects in a REST API context. + */ +export type WP_REST_API_Font_Families = WP_REST_API_Font_Family[]; +/** + * A collection of font face objects in a REST API context. + */ +export type WP_REST_API_Font_Faces = WP_REST_API_Font_Face[]; /** * A collection of post objects in a REST API context. */ @@ -144,6 +152,10 @@ export interface WP { Comments: WP_REST_API_Comments; Font_Collection: WP_REST_API_Font_Collection; Font_Collections: WP_REST_API_Font_Collections; + Font_Family: WP_REST_API_Font_Family; + Font_Families: WP_REST_API_Font_Families; + Font_Face: WP_REST_API_Font_Face; + Font_Faces: WP_REST_API_Font_Faces; Post: WP_REST_API_Post; Posts: WP_REST_API_Posts; Page: WP_REST_API_Page; @@ -1977,10 +1989,13 @@ export interface WP_REST_API_Font_Collection { * CSS unicode-range value. */ unicodeRange?: string; + [k: string]: unknown; }[]; preview?: string; + [k: string]: unknown; }; categories?: string[]; + [k: string]: unknown; }[]; /** * The categories for the font collection. @@ -1988,10 +2003,102 @@ export interface WP_REST_API_Font_Collection { categories: { name: string; slug: string; + [k: string]: unknown; }[]; _links: WP_REST_API_Object_Links; [k: string]: unknown; } +/** + * A font family object in a REST API context. + */ +export interface WP_REST_API_Font_Family { + /** + * Unique identifier for the font family. + */ + id: number; + /** + * Version of the theme.json schema used for the typography settings. + */ + theme_json_version: number; + /** + * The IDs of the child font faces in the font family. + */ + font_faces: number[]; + font_family_settings: { + name?: string; + slug?: string; + fontFamily?: string; + preview?: string; + [k: string]: unknown; + }; + _links: WP_REST_API_Object_Links; + /** + * The embedded representation of relations. Only present when the '_embed' query parameter is set. + */ + _embedded?: { + /** + * The associated font faces. + */ + font_faces?: unknown[]; + [k: string]: unknown; + }; + [k: string]: unknown; +} +/** + * A font face object in a REST API context. + */ +export interface WP_REST_API_Font_Face { + /** + * Unique identifier for the font face. + */ + id: number; + /** + * Version of the theme.json schema used for the typography settings. + */ + theme_json_version: number; + /** + * The ID for the parent font family of the font face. + */ + parent: number; + /** + * font-face declaration in theme.json format. + */ + font_face_settings: { + /** + * Unique identifier for the font family. + */ + id?: number; + /** + * Version of the theme.json schema used for the typography settings. + */ + theme_json_version?: number; + /** + * The IDs of the child font faces in the font family. + */ + font_faces?: number[]; + font_family_settings?: { + name?: string; + slug?: string; + fontFamily?: string; + preview?: string; + [k: string]: unknown; + }; + _links?: WP_REST_API_Object_Links; + /** + * The embedded representation of relations. Only present when the '_embed' query parameter is set. + */ + _embedded?: { + /** + * The associated font faces. + */ + font_faces?: unknown[]; + [k: string]: unknown; + }; + [k: string]: unknown; + }; + _links: WP_REST_API_Object_Links; + [k: string]: unknown; +} /** * A post object in a REST API context. */ diff --git a/schema.json b/schema.json index 52a2de3..a07a8cb 100644 --- a/schema.json +++ b/schema.json @@ -92,6 +92,12 @@ "Font_Families": { "$ref": "schemas/rest-api/collections/font-families.json" }, + "Font_Face": { + "$ref": "schemas/rest-api/font-face.json" + }, + "Font_Faces": { + "$ref": "schemas/rest-api/collections/font-faces.json" + }, "Post": { "$ref": "schemas/rest-api/post.json" }, @@ -217,6 +223,8 @@ "Font_Collections", "Font_Family", "Font_Families", + "Font_Face", + "Font_Faces", "Post", "Posts", "Page", diff --git a/schemas/rest-api/collections/font-faces.json b/schemas/rest-api/collections/font-faces.json new file mode 100644 index 0000000..caef5e7 --- /dev/null +++ b/schemas/rest-api/collections/font-faces.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/font-faces.json", + "title": "WP_REST_API_Font_Faces", + "description": "A collection of font face objects in a REST API context.", + "type": "array", + "items": { + "$ref": "../font-face.json" + } +} diff --git a/schemas/rest-api/font-collection.json b/schemas/rest-api/font-collection.json index 9f97fc7..99046a8 100644 --- a/schemas/rest-api/font-collection.json +++ b/schemas/rest-api/font-collection.json @@ -148,7 +148,7 @@ "type": "string" } }, - "additionalProperties": false + "additionalProperties": true } }, "preview": { @@ -156,7 +156,7 @@ "format": "uri" } }, - "additionalProperties": false + "additionalProperties": true }, "categories": { "type": "array", @@ -165,7 +165,7 @@ } } }, - "additionalProperties": false + "additionalProperties": true } }, "categories": { @@ -185,7 +185,7 @@ "type": "string" } }, - "additionalProperties": false + "additionalProperties": true } }, "_links": { diff --git a/schemas/rest-api/font-face.json b/schemas/rest-api/font-face.json new file mode 100644 index 0000000..a6a2f9a --- /dev/null +++ b/schemas/rest-api/font-face.json @@ -0,0 +1,136 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/font-face.json", + "title": "WP_REST_API_Font_Face", + "description": "A font face object in a REST API context.", + "$comment": "See also https://schemas.wp.org/trunk/font-face.json", + "type": "object", + "required": [ + "id", + "theme_json_version", + "parent", + "font_face_settings", + "_links" + ], + "properties": { + "id": { + "readOnly": true, + "description": "Unique identifier for the font face.", + "type": "integer" + }, + "theme_json_version": { + "description": "Version of the theme.json schema used for the typography settings.", + "type": "integer" + }, + "parent": { + "description": "The ID for the parent font family of the font face.", + "type": "integer" + }, + "font_face_settings": { + "description": "font-face declaration in theme.json format.", + "type": "object", + "properties": { + "id": { + "readOnly": true, + "description": "Unique identifier for the font family.", + "type": "integer" + }, + "theme_json_version": { + "description": "Version of the theme.json schema used for the typography settings.", + "type": "integer" + }, + "font_faces": { + "description": "The IDs of the child font faces in the font family.", + "type": "array", + "items": { + "type": "integer" + } + }, + "font_family_settings": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "fontFamily": { + "type": "string" + }, + "preview": { + "type": "string", + "format": "uri" + } + } + }, + "_links": { + "$ref": "properties/object-links.json" + }, + "_embedded": { + "description": "The embedded representation of relations. Only present when the '_embed' query parameter is set.", + "type": "object", + "properties": { + "font_faces": { + "description": "The associated font faces.", + "type": "array" + } + } + } + } + }, + "_links": { + "$ref": "properties/object-links.json" + } + }, + "links": [ + { + "rel": "self", + "href": "/wp/v2/font-families/{parent}/font-faces/{id}", + "hrefSchema": { + "properties": { + "parent": { + "$ref": "#/properties/parent" + }, + "id": { + "$ref": "#/properties/id" + } + } + }, + "targetSchema": { + "$ref": "#" + } + }, + { + "rel": "collection", + "href": "/wp/v2/font-families/{parent}/font-faces", + "hrefSchema": { + "properties": { + "parent": { + "$ref": "#/properties/parent" + } + } + }, + "targetSchema": { + "type": "array", + "items": { + "$ref": "#" + } + } + }, + { + "rel": "parent", + "href": "/wp/v2/font-families/{parent}", + "hrefSchema": { + "properties": { + "parent": { + "$ref": "#/properties/parent" + } + } + }, + "targetSchema": { + "$ref": "font-family.json" + } + } + ] +} diff --git a/schemas/rest-api/font-family.json b/schemas/rest-api/font-family.json index 7e9893c..4b5cd3f 100644 --- a/schemas/rest-api/font-family.json +++ b/schemas/rest-api/font-family.json @@ -49,6 +49,16 @@ }, "_links": { "$ref": "properties/object-links.json" + }, + "_embedded": { + "description": "The embedded representation of relations. Only present when the '_embed' query parameter is set.", + "type": "object", + "properties": { + "font_faces": { + "description": "The associated font faces.", + "type": "array" + } + } } }, "links": [ @@ -76,6 +86,5 @@ } } } - ], - "additionalProperties": false + ] } diff --git a/tests/external-schemas/font-collection.json b/tests/external-schemas/font-collection.json index e52455b..05f4657 100644 --- a/tests/external-schemas/font-collection.json +++ b/tests/external-schemas/font-collection.json @@ -37,7 +37,13 @@ "description": "CSS font-display value.", "type": "string", "default": "fallback", - "enum": [ "auto", "block", "fallback", "swap", "optional" ] + "enum": [ + "auto", + "block", + "fallback", + "swap", + "optional" + ] }, "src": { "description": "Paths or URLs to the font files.", @@ -91,7 +97,10 @@ "type": "string" } }, - "required": [ "fontFamily", "src" ], + "required": [ + "fontFamily", + "src" + ], "additionalProperties": false } }, @@ -138,7 +147,11 @@ } } }, - "required": [ "name", "fontFamily", "slug" ], + "required": [ + "name", + "fontFamily", + "slug" + ], "additionalProperties": false }, "categories": { @@ -149,11 +162,15 @@ } } }, - "required": [ "font_family_settings" ], + "required": [ + "font_family_settings" + ], "additionalProperties": false } } }, "additionalProperties": false, - "required": [ "font_families" ] -} + "required": [ + "font_families" + ] +} \ No newline at end of file diff --git a/tests/external-schemas/font-face.json b/tests/external-schemas/font-face.json new file mode 100644 index 0000000..757e0e4 --- /dev/null +++ b/tests/external-schemas/font-face.json @@ -0,0 +1,95 @@ +{ + "type": "object", + "properties": { + "fontFamily": { + "description": "CSS font-family value.", + "type": "string", + "default": "" + }, + "fontStyle": { + "description": "CSS font-style value.", + "type": "string", + "default": "normal" + }, + "fontWeight": { + "description": "List of available font weights, separated by a space.", + "default": "400", + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "fontDisplay": { + "description": "CSS font-display value.", + "type": "string", + "default": "fallback", + "enum": [ + "auto", + "block", + "fallback", + "swap", + "optional" + ] + }, + "src": { + "description": "Paths or URLs to the font files.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "default": [] + }, + "fontStretch": { + "description": "CSS font-stretch value.", + "type": "string" + }, + "ascentOverride": { + "description": "CSS ascent-override value.", + "type": "string" + }, + "descentOverride": { + "description": "CSS descent-override value.", + "type": "string" + }, + "fontVariant": { + "description": "CSS font-variant value.", + "type": "string" + }, + "fontFeatureSettings": { + "description": "CSS font-feature-settings value.", + "type": "string" + }, + "fontVariationSettings": { + "description": "CSS font-variation-settings value.", + "type": "string" + }, + "lineGapOverride": { + "description": "CSS line-gap-override value.", + "type": "string" + }, + "sizeAdjust": { + "description": "CSS size-adjust value.", + "type": "string" + }, + "unicodeRange": { + "description": "CSS unicode-range value.", + "type": "string" + } + }, + "required": [ + "fontFamily", + "src" + ], + "additionalProperties": false +} \ No newline at end of file diff --git a/tests/mu-plugins/mu-plugin.php b/tests/mu-plugins/mu-plugin.php index 70c20b3..8743452 100644 --- a/tests/mu-plugins/mu-plugin.php +++ b/tests/mu-plugins/mu-plugin.php @@ -2,6 +2,8 @@ namespace WPJsonSchemas; +use Ergebnis\Json\Printer; + use WP_CLI; use WP_REST_Request; use WP_REST_Response; @@ -14,6 +16,8 @@ return; } +require_once dirname( __DIR__, 2 ) . '/vendor/autoload.php'; + set_error_handler( function( int $errno, string $errstr, string $errfile = '', int $errline = 0 ) : bool { // This is an @-suppressed error: if ( ! ( error_reporting() & $errno ) ) { @@ -104,7 +108,7 @@ function save_rest_array( array $data, string $dir ) : void { } } -function save_external_schema( string $url, string $name ) : void { +function save_external_schema( string $url, string $name, array $path = [] ) : void { $target = dirname( ABSPATH ) . "/external-schemas/{$name}.json"; $schema = download_url( $url ); @@ -112,10 +116,39 @@ function save_external_schema( string $url, string $name ) : void { throw new \Exception( "Failed to download external {$name} schema." ); } - $renamed = rename( $schema, $target ); + $file = file_get_contents( $schema ); + + if ( ! $file ) { + throw new \Exception( "Failed to open {$name} schema file." ); + } + + $data = json_decode( $file, true ); + + if ( ! $data ) { + throw new \Exception( "Failed to parse external {$name} schema." ); + } + + foreach ( $path as $key ) { + if ( isset( $data[ $key ] ) ) { + $data = $data[ $key ]; + } else { + throw new \Exception( "Failed to find path {$key} in external {$name} schema." ); + } + } + + $json = json_encode( $data, JSON_PRETTY_PRINT ^ JSON_UNESCAPED_SLASHES ); + + $printer = new Printer\Printer(); + + $json = $printer->print( + $json, + "\t", + ); + + $result = file_put_contents( $target, $json ); - if ( ! $renamed ) { - throw new \Exception( "Failed to rename external {$name} schema." ); + if ( ! $result ) { + throw new \Exception( "Failed to save external {$name} schema." ); } } diff --git a/tests/output/fonts.php b/tests/output/fonts.php index dce4736..89fe94e 100644 --- a/tests/output/fonts.php +++ b/tests/output/fonts.php @@ -51,5 +51,9 @@ save_external_schema( 'https://schemas.wp.org/trunk/theme.json', - 'font-family' + 'font-face', + [ + 'definitions', + 'fontFace', + ] ); From 3431d6c14eecf8e7a7e862f831ccde93d75f5e2b Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 14 Jul 2024 18:42:10 +0200 Subject: [PATCH 61/62] DRY. --- packages/wp-types/index.ts | 164 +++++++++--------- schemas/rest-api/font-collection.json | 127 +------------- schemas/rest-api/font-face.json | 19 +- schemas/rest-api/font-family.json | 19 +- schemas/rest-api/properties/font-face.json | 99 +++++++++++ .../properties/font-family-settings.json | 38 ++++ 6 files changed, 229 insertions(+), 237 deletions(-) create mode 100644 schemas/rest-api/properties/font-face.json create mode 100644 schemas/rest-api/properties/font-family-settings.json diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 3cc8c36..0adfa8a 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -1924,78 +1924,8 @@ export interface WP_REST_API_Font_Collection { * The font families for the font collection. */ font_families: { - font_family_settings: { - name: string; - fontFamily: string; - slug: string; - fontFace?: { - /** - * URL to a preview image of the font. - */ - preview?: string; - /** - * CSS font-family value. - */ - fontFamily: string; - /** - * CSS font-style value. - */ - fontStyle?: string; - /** - * List of available font weights, separated by a space. - */ - fontWeight?: string | number; - /** - * CSS font-display value. - */ - fontDisplay?: "auto" | "block" | "fallback" | "swap" | "optional"; - /** - * Paths or URLs to the font files. - */ - src: string | string[]; - /** - * CSS font-stretch value. - */ - fontStretch?: string; - /** - * CSS ascent-override value. - */ - ascentOverride?: string; - /** - * CSS descent-override value. - */ - descentOverride?: string; - /** - * CSS font-variant value. - */ - fontVariant?: string; - /** - * CSS font-feature-settings value. - */ - fontFeatureSettings?: string; - /** - * CSS font-variation-settings value. - */ - fontVariationSettings?: string; - /** - * CSS line-gap-override value. - */ - lineGapOverride?: string; - /** - * CSS size-adjust value. - */ - sizeAdjust?: string; - /** - * CSS unicode-range value. - */ - unicodeRange?: string; - [k: string]: unknown; - }[]; - preview?: string; - [k: string]: unknown; - }; + font_family_settings: WP_Font_Family_Settings; categories?: string[]; - [k: string]: unknown; }[]; /** * The categories for the font collection. @@ -2003,11 +1933,85 @@ export interface WP_REST_API_Font_Collection { categories: { name: string; slug: string; - [k: string]: unknown; }[]; _links: WP_REST_API_Object_Links; [k: string]: unknown; } +/** + * Font family settings. + */ +export interface WP_Font_Family_Settings { + name: string; + fontFamily: string; + slug: string; + fontFace?: WP_Font_Face[]; + preview?: string; +} +/** + * A font face. + */ +export interface WP_Font_Face { + /** + * URL to a preview image of the font. + */ + preview?: string; + /** + * CSS font-family value. + */ + fontFamily: string; + /** + * CSS font-style value. + */ + fontStyle?: string; + /** + * List of available font weights, separated by a space. + */ + fontWeight?: string | number; + /** + * CSS font-display value. + */ + fontDisplay?: "auto" | "block" | "fallback" | "swap" | "optional"; + /** + * Paths or URLs to the font files. + */ + src: string | string[]; + /** + * CSS font-stretch value. + */ + fontStretch?: string; + /** + * CSS ascent-override value. + */ + ascentOverride?: string; + /** + * CSS descent-override value. + */ + descentOverride?: string; + /** + * CSS font-variant value. + */ + fontVariant?: string; + /** + * CSS font-feature-settings value. + */ + fontFeatureSettings?: string; + /** + * CSS font-variation-settings value. + */ + fontVariationSettings?: string; + /** + * CSS line-gap-override value. + */ + lineGapOverride?: string; + /** + * CSS size-adjust value. + */ + sizeAdjust?: string; + /** + * CSS unicode-range value. + */ + unicodeRange?: string; +} /** * A font family object in a REST API context. */ @@ -2024,13 +2028,7 @@ export interface WP_REST_API_Font_Family { * The IDs of the child font faces in the font family. */ font_faces: number[]; - font_family_settings: { - name?: string; - slug?: string; - fontFamily?: string; - preview?: string; - [k: string]: unknown; - }; + font_family_settings: WP_Font_Family_Settings; _links: WP_REST_API_Object_Links; /** * The embedded representation of relations. Only present when the '_embed' query parameter is set. @@ -2076,13 +2074,7 @@ export interface WP_REST_API_Font_Face { * The IDs of the child font faces in the font family. */ font_faces?: number[]; - font_family_settings?: { - name?: string; - slug?: string; - fontFamily?: string; - preview?: string; - [k: string]: unknown; - }; + font_family_settings?: WP_Font_Family_Settings; _links?: WP_REST_API_Object_Links; /** * The embedded representation of relations. Only present when the '_embed' query parameter is set. diff --git a/schemas/rest-api/font-collection.json b/schemas/rest-api/font-collection.json index 99046a8..37aa8b5 100644 --- a/schemas/rest-api/font-collection.json +++ b/schemas/rest-api/font-collection.json @@ -37,126 +37,11 @@ ], "properties": { "font_family_settings": { - "type": "object", - "required": [ - "name", - "fontFamily", - "slug" - ], - "properties": { - "name": { - "type": "string" - }, - "fontFamily": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "fontFace": { - "type": "array", - "items": { - "type": "object", - "required": [ - "src", - "fontFamily" - ], - "properties": { - "preview": { - "description": "URL to a preview image of the font.", - "type": "string", - "format": "uri" - }, - "fontFamily": { - "description": "CSS font-family value.", - "type": "string" - }, - "fontStyle": { - "description": "CSS font-style value.", - "type": "string" - }, - "fontWeight": { - "description": "List of available font weights, separated by a space.", - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - } - ] - }, - "fontDisplay": { - "description": "CSS font-display value.", - "type": "string", - "enum": [ - "auto", - "block", - "fallback", - "swap", - "optional" - ] - }, - "src": { - "description": "Paths or URLs to the font files.", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "fontStretch": { - "description": "CSS font-stretch value.", - "type": "string" - }, - "ascentOverride": { - "description": "CSS ascent-override value.", - "type": "string" - }, - "descentOverride": { - "description": "CSS descent-override value.", - "type": "string" - }, - "fontVariant": { - "description": "CSS font-variant value.", - "type": "string" - }, - "fontFeatureSettings": { - "description": "CSS font-feature-settings value.", - "type": "string" - }, - "fontVariationSettings": { - "description": "CSS font-variation-settings value.", - "type": "string" - }, - "lineGapOverride": { - "description": "CSS line-gap-override value.", - "type": "string" - }, - "sizeAdjust": { - "description": "CSS size-adjust value.", - "type": "string" - }, - "unicodeRange": { - "description": "CSS unicode-range value.", - "type": "string" - } - }, - "additionalProperties": true - } - }, - "preview": { - "type": "string", - "format": "uri" + "oneOf": [ + { + "$ref": "properties/font-family-settings.json" } - }, - "additionalProperties": true + ] }, "categories": { "type": "array", @@ -165,7 +50,7 @@ } } }, - "additionalProperties": true + "additionalProperties": false } }, "categories": { @@ -185,7 +70,7 @@ "type": "string" } }, - "additionalProperties": true + "additionalProperties": false } }, "_links": { diff --git a/schemas/rest-api/font-face.json b/schemas/rest-api/font-face.json index a6a2f9a..a118a60 100644 --- a/schemas/rest-api/font-face.json +++ b/schemas/rest-api/font-face.json @@ -47,22 +47,11 @@ } }, "font_family_settings": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "fontFamily": { - "type": "string" - }, - "preview": { - "type": "string", - "format": "uri" + "oneOf": [ + { + "$ref": "properties/font-family-settings.json" } - } + ] }, "_links": { "$ref": "properties/object-links.json" diff --git a/schemas/rest-api/font-family.json b/schemas/rest-api/font-family.json index 4b5cd3f..f8c5414 100644 --- a/schemas/rest-api/font-family.json +++ b/schemas/rest-api/font-family.json @@ -30,22 +30,11 @@ } }, "font_family_settings": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "fontFamily": { - "type": "string" - }, - "preview": { - "type": "string", - "format": "uri" + "oneOf": [ + { + "$ref": "properties/font-family-settings.json" } - } + ] }, "_links": { "$ref": "properties/object-links.json" diff --git a/schemas/rest-api/properties/font-face.json b/schemas/rest-api/properties/font-face.json new file mode 100644 index 0000000..2587799 --- /dev/null +++ b/schemas/rest-api/properties/font-face.json @@ -0,0 +1,99 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/properties/font-face.json", + "title": "WP_Font_Face", + "description": "A font face.", + "type": "object", + "required": [ + "src", + "fontFamily" + ], + "properties": { + "preview": { + "description": "URL to a preview image of the font.", + "type": "string", + "format": "uri" + }, + "fontFamily": { + "description": "CSS font-family value.", + "type": "string" + }, + "fontStyle": { + "description": "CSS font-style value.", + "type": "string" + }, + "fontWeight": { + "description": "List of available font weights, separated by a space.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "fontDisplay": { + "description": "CSS font-display value.", + "type": "string", + "enum": [ + "auto", + "block", + "fallback", + "swap", + "optional" + ] + }, + "src": { + "description": "Paths or URLs to the font files.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "fontStretch": { + "description": "CSS font-stretch value.", + "type": "string" + }, + "ascentOverride": { + "description": "CSS ascent-override value.", + "type": "string" + }, + "descentOverride": { + "description": "CSS descent-override value.", + "type": "string" + }, + "fontVariant": { + "description": "CSS font-variant value.", + "type": "string" + }, + "fontFeatureSettings": { + "description": "CSS font-feature-settings value.", + "type": "string" + }, + "fontVariationSettings": { + "description": "CSS font-variation-settings value.", + "type": "string" + }, + "lineGapOverride": { + "description": "CSS line-gap-override value.", + "type": "string" + }, + "sizeAdjust": { + "description": "CSS size-adjust value.", + "type": "string" + }, + "unicodeRange": { + "description": "CSS unicode-range value.", + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/schemas/rest-api/properties/font-family-settings.json b/schemas/rest-api/properties/font-family-settings.json new file mode 100644 index 0000000..d66ee7d --- /dev/null +++ b/schemas/rest-api/properties/font-family-settings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/properties/font-family-settings.json", + "title": "WP_Font_Family_Settings", + "description": "Font family settings.", + "type": "object", + "required": [ + "name", + "fontFamily", + "slug" + ], + "properties": { + "name": { + "type": "string" + }, + "fontFamily": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "fontFace": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "./font-face.json" + } + ] + } + }, + "preview": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false +} From e21ba1724a0d8e863cfc27c59bbad17567a54e6f Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 14 Jul 2024 22:31:45 +0200 Subject: [PATCH 62/62] 3.66.0 --- package.json | 2 +- packages/wp-types/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e6250a6..e0ff7a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-json-schemas", - "version": "3.65.0", + "version": "3.66.0", "description": "JSON schemas for WordPress PHP objects and REST API responses", "main": "schema.json", "files": [ diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index 7722873..e7b18d4 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -1,6 +1,6 @@ { "name": "wp-types", - "version": "3.65.0", + "version": "3.66.0", "description": "TypeScript definitions of WordPress PHP objects and REST API responses.", "main": "", "types": "index.ts",