diff --git a/.nvmrc b/.nvmrc index b6a7d89..209e3ef 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +20 diff --git a/composer.json b/composer.json index 32fdcad..4391767 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "@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", + "./tests/bin/build-wp-types.sh", "npm run test-wp-types", "rm -f tests/wordpress/wp-content/database/.ht.sqlite", diff --git a/package.json b/package.json index 3c4c914..ae93722 100644 --- a/package.json +++ b/package.json @@ -20,15 +20,14 @@ "license": "MIT", "devDependencies": { "ajv-cli": "^5.0", - "ajv-formats": "^2.0", - "json-schema-to-typescript": "^12.0", - "node-jq": "^2.3.5", - "typescript": ">=3" + "ajv-formats": "^3.0", + "json-schema-to-typescript": "^15.0", + "node-jq": "^6.0", + "typescript": ">=5" }, "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", - "test-wp-types": "tsc packages/wp-types/tests/test.ts --noEmit --strict", - "validate": "ajv compile --strict --strict-schema=false -c ajv-formats -m tests/external-schemas/hyper-schema.json -s schema.json -r \"schemas/**/*.json\"" + "test-wp-types": "tsc packages/wp-types/tests/test.ts --noEmit --strict --target es2015", + "validate": "ajv compile --spec=draft2019 --strict --strict-schema=false -c ajv-formats -m tests/external-schemas/hyper-schema.json -s schema.json -r \"schemas/**/*.json\"" } } diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index 3d552ee..747f522 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -48,6 +48,42 @@ 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 post object in a REST API context. + */ +export type WP_REST_API_Post = WP_REST_API_Partial_Post_Common & + WP_REST_API_Partial_Post_Author & + WP_REST_API_Partial_Post_Public & + WP_REST_API_Partial_Post_Comments & + WP_REST_API_Partial_Post_Excerpt & { + /** + * The embedded representation of relations. Only present when the '_embed' query parameter is set. + */ + _embedded?: { + /** + * The author of the post. + */ + author: unknown[]; + /** + * The replies to the post (comments, pingbacks, trackbacks). + */ + replies?: unknown[]; + /** + * The taxonomy terms for the post. + */ + "wp:term"?: unknown[]; + /** + * The featured image post. + */ + "wp:featuredmedia"?: unknown[]; + /** + * The parent post. + */ + up?: unknown[]; + [k: string]: unknown; + }; + [k: string]: unknown; + }; /** * A collection of post objects in a REST API context. */ @@ -55,7 +91,39 @@ export type WP_REST_API_Posts = WP_REST_API_Post[]; /** * A page object in a REST API context. */ -export type WP_REST_API_Page = WP_REST_API_Post; +export type WP_REST_API_Page = WP_REST_API_Partial_Post_Common & + WP_REST_API_Partial_Post_Author & + WP_REST_API_Partial_Post_Public & + WP_REST_API_Partial_Post_Comments & + WP_REST_API_Partial_Post_Excerpt & { + /** + * The embedded representation of relations. Only present when the '_embed' query parameter is set. + */ + _embedded?: { + /** + * The author of the page. + */ + author: unknown[]; + /** + * The replies to the page (comments, pingbacks, trackbacks). + */ + replies?: unknown[]; + /** + * The taxonomy terms for the page. + */ + "wp:term"?: unknown[]; + /** + * The featured image page. + */ + "wp:featuredmedia"?: unknown[]; + /** + * The parent page. + */ + up?: unknown[]; + [k: string]: unknown; + }; + [k: string]: unknown; + }; /** * A collection of page objects in a REST API context. */ @@ -2106,9 +2174,9 @@ export interface WP_REST_API_Font_Face { [k: string]: unknown; } /** - * A post object in a REST API context. + * Common post properties */ -export interface WP_REST_API_Post { +interface WP_REST_API_Partial_Post_Common { /** * The date the post was published, in the site's timezone. */ @@ -2162,14 +2230,6 @@ export interface WP_REST_API_Post { * A password to protect access to the content and excerpt. Only present when using the 'edit' context. */ password?: string; - /** - * Permalink template for the post. Only present when using the 'edit' context and the post type is public. - */ - permalink_template?: string; - /** - * Slug automatically generated from the post title. Only present when using the 'edit' context and the post type is public. - */ - generated_slug?: string; /** * The ID for the parent of the post. Only present for hierarchical post types. */ @@ -2178,10 +2238,6 @@ 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. */ @@ -2216,39 +2272,10 @@ export interface WP_REST_API_Post { */ protected: boolean; }; - /** - * The ID for the author of the post. - */ - author: number; - /** - * The excerpt for the post. - */ - excerpt: { - /** - * Excerpt for the post, as it exists in the database. Only present when using the 'edit' context. - */ - raw?: string; - /** - * HTML excerpt for the post, transformed for display. - */ - rendered: string; - /** - * Whether the excerpt is protected with a password. - */ - protected: boolean; - }; /** * The ID of the featured media for the post. */ featured_media?: number; - /** - * Whether or not comments are open on the post. - */ - comment_status: WP_Post_Comment_Status_Name; - /** - * Whether or not the post can be pinged. - */ - ping_status: WP_Post_Comment_Status_Name; /** * The format for the post. */ @@ -2256,7 +2283,7 @@ export interface WP_REST_API_Post { /** * Meta fields. */ - meta: + meta?: | EmptyArray | { [k: string]: unknown; @@ -2278,33 +2305,67 @@ export interface WP_REST_API_Post { */ tags?: number[]; _links: WP_REST_API_Object_Links; +} +/** + * Hello. + */ +interface WP_REST_API_Partial_Post_Author { /** - * The embedded representation of relations. Only present when the '_embed' query parameter is set. + * The ID for the author of the post. */ - _embedded?: { - /** - * The author of the post. - */ - author: unknown[]; - /** - * The replies to the post (comments, pingbacks, trackbacks). - */ - replies?: unknown[]; + author: number; +} +/** + * Properties for public post types + */ +interface WP_REST_API_Partial_Post_Public { + /** + * Permalink template for the post. Only present when using the 'edit' context and the post type is public. + */ + permalink_template?: string; + /** + * Slug automatically generated from the post 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[]; +} +/** + * Properties for post types that support comments + */ +interface WP_REST_API_Partial_Post_Comments { + /** + * Whether or not comments are open on the post. + */ + comment_status: WP_Post_Comment_Status_Name; + /** + * Whether or not the post can be pinged. + */ + ping_status: WP_Post_Comment_Status_Name; +} +/** + * Properties for post types that support an excerpt + */ +interface WP_REST_API_Partial_Post_Excerpt { + /** + * The excerpt for the post. + */ + excerpt: { /** - * The taxonomy terms for the post. + * Excerpt for the post, as it exists in the database. Only present when using the 'edit' context. */ - "wp:term"?: unknown[]; + raw?: string; /** - * The featured image post. + * HTML excerpt for the post, transformed for display. */ - "wp:featuredmedia"?: unknown[]; + rendered: string; /** - * The parent post. + * Whether the excerpt is protected with a password. */ - up?: unknown[]; - [k: string]: unknown; + protected: boolean; }; - [k: string]: unknown; } /** * A media attachment object in a REST API context. diff --git a/packages/wp-types/package.json b/packages/wp-types/package.json index 23b08c1..f8cfb88 100644 --- a/packages/wp-types/package.json +++ b/packages/wp-types/package.json @@ -16,6 +16,6 @@ "author": "John Blackbourn", "license": "MIT", "dependencies": { - "typescript": ">=3" + "typescript": ">=5" } } diff --git a/packages/wp-types/tsconfig.json b/packages/wp-types/tsconfig.json deleted file mode 100644 index 9c02dc6..0000000 --- a/packages/wp-types/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "strict": true - }, - "include": [ - "index.ts" - ] -} diff --git a/schema.json b/schema.json index 35ce564..cac97d3 100644 --- a/schema.json +++ b/schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schema.json", "title": "WP", "description": "WordPress is open source software you can use to create a beautiful website, blog, or app.", diff --git a/schemas/block-template.json b/schemas/block-template.json index db68f25..a8a9891 100644 --- a/schemas/block-template.json +++ b/schemas/block-template.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/block-type.json b/schemas/block-type.json index 0c87544..726b3fa 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/block-type.json", "title": "WP_Block_Type", "description": "Core class representing a block type.", diff --git a/schemas/block.json b/schemas/block.json index 6f4f1ae..6bd6677 100644 --- a/schemas/block.json +++ b/schemas/block.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/block.json", "title": "WP_Block", "description": "Class representing a parsed instance of a block.", diff --git a/schemas/comment.json b/schemas/comment.json index a5ab28f..6a50573 100644 --- a/schemas/comment.json +++ b/schemas/comment.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/comment.json", "title": "WP_Comment", "description": "Core class used to organize comments as instantiated objects with defined members.", diff --git a/schemas/error-with-error.json b/schemas/error-with-error.json index 0e979b0..5e2f064 100644 --- a/schemas/error-with-error.json +++ b/schemas/error-with-error.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/error-with-error.json", "title": "WP_Error_With_Error", "description": "WordPress Error class.\n\nRepresents a WP_Error object that contains at least one error.", diff --git a/schemas/error-without-error.json b/schemas/error-without-error.json index a17fc3f..4a3e3f7 100644 --- a/schemas/error-without-error.json +++ b/schemas/error-without-error.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/error-without-error.json", "title": "WP_Error_Without_Error", "description": "Empty WordPress Error class.\n\nRepresents a WP_Error object that contains no errors.", diff --git a/schemas/error.json b/schemas/error.json index 2b16330..c663771 100644 --- a/schemas/error.json +++ b/schemas/error.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/error.json", "title": "WP_Error", "description": "WordPress Error class.\n\nContainer for checking for WordPress errors and error messages. Many core WordPress functions pass this class in the event of an error.", diff --git a/schemas/locale.json b/schemas/locale.json index e392d74..f4ce7dd 100644 --- a/schemas/locale.json +++ b/schemas/locale.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/locale.json", "title": "WP_Locale", "description": "Core class used to store translated data for a locale.", diff --git a/schemas/network.json b/schemas/network.json index d8f3d9a..624d437 100644 --- a/schemas/network.json +++ b/schemas/network.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/network.json", "title": "WP_Network", "description": "Core class used for interacting with a multisite network.", diff --git a/schemas/post-type.json b/schemas/post-type.json index 8581194..74588aa 100644 --- a/schemas/post-type.json +++ b/schemas/post-type.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/post-type.json", "title": "WP_Post_Type", "description": "Core class used for interacting with post types.", diff --git a/schemas/post.json b/schemas/post.json index 3b24b62..be3b12d 100644 --- a/schemas/post.json +++ b/schemas/post.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/post.json", "title": "WP_Post", "description": "Core class used to implement the WP_Post object.", diff --git a/schemas/properties/block-parsed.json b/schemas/properties/block-parsed.json index e193e1d..a28ab16 100644 --- a/schemas/properties/block-parsed.json +++ b/schemas/properties/block-parsed.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/block-parsed.json", "title": "WP_Block_Parsed", "description": "Original parsed array representation of block.", diff --git a/schemas/properties/callable.json b/schemas/properties/callable.json index 2c67f03..54d8a35 100644 --- a/schemas/properties/callable.json +++ b/schemas/properties/callable.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/callable.json", "title": "Callable", "tsType": "any", diff --git a/schemas/properties/comment-status-name.json b/schemas/properties/comment-status-name.json index 02b584a..326a76f 100644 --- a/schemas/properties/comment-status-name.json +++ b/schemas/properties/comment-status-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/comment-status-name.json", "title": "WP_Comment_Status_Name", "type": "string", diff --git a/schemas/properties/comment-type-name.json b/schemas/properties/comment-type-name.json index b78cf29..60bb04e 100644 --- a/schemas/properties/comment-type-name.json +++ b/schemas/properties/comment-type-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/comment-type-name.json", "title": "WP_Comment_Type_Name", "type": "string", diff --git a/schemas/properties/date-time.json b/schemas/properties/date-time.json index fa7b98d..66df9d3 100644 --- a/schemas/properties/date-time.json +++ b/schemas/properties/date-time.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/date-time.json", "title": "WP_Date_Time", "description": "Timestamp in MySQL DATETIME format (`YYYY-MM-DD hh:mm:ss`).", diff --git a/schemas/properties/error-data.json b/schemas/properties/error-data.json index b2920e1..abbd896 100644 --- a/schemas/properties/error-data.json +++ b/schemas/properties/error-data.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/error-data.json", "title": "WP_Error_Data", "description": "The data for the errors contained within the error object.\n\nEach error is represented by a property keyed by the error code, and containing error data for that code. Any given error code can contain only one piece of error data, but the data can be of any type.", diff --git a/schemas/properties/error-messages.json b/schemas/properties/error-messages.json index c594b81..ad8d0af 100644 --- a/schemas/properties/error-messages.json +++ b/schemas/properties/error-messages.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/error-messages.json", "title": "WP_Error_Messages", "description": "The messages for the errors contained within the error object.\n\nEach error is represented by a property keyed by the error code, and containing an array of message strings for that code. Any given error code usually contains only one message, but can contain more.", diff --git a/schemas/properties/object-filter-context.json b/schemas/properties/object-filter-context.json index 421198a..f0ef7f9 100644 --- a/schemas/properties/object-filter-context.json +++ b/schemas/properties/object-filter-context.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/object-filter-context.json", "title": "WP_Object_Filter_Context", "type": "string", diff --git a/schemas/properties/post-comment-status-name.json b/schemas/properties/post-comment-status-name.json index 3ebdb56..0c2ee01 100644 --- a/schemas/properties/post-comment-status-name.json +++ b/schemas/properties/post-comment-status-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/post-comment-status-name.json", "title": "WP_Post_Comment_Status_Name", "type": "string", diff --git a/schemas/properties/post-format-name.json b/schemas/properties/post-format-name.json index b7dc77e..ad696f4 100644 --- a/schemas/properties/post-format-name.json +++ b/schemas/properties/post-format-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/post-format-name.json", "title": "WP_Post_Format_Name", "type": "string", diff --git a/schemas/properties/post-status-name.json b/schemas/properties/post-status-name.json index 4a3fa6f..b276c3f 100644 --- a/schemas/properties/post-status-name.json +++ b/schemas/properties/post-status-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/post-status-name.json", "title": "WP_Post_Status_Name", "type": "string", diff --git a/schemas/properties/post-type-caps.json b/schemas/properties/post-type-caps.json index fe23f7a..7443a68 100644 --- a/schemas/properties/post-type-caps.json +++ b/schemas/properties/post-type-caps.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/post-type-caps.json", "title": "WP_Post_Type_Caps", "type": "object", diff --git a/schemas/properties/post-type-labels.json b/schemas/properties/post-type-labels.json index 14b366b..65f4519 100644 --- a/schemas/properties/post-type-labels.json +++ b/schemas/properties/post-type-labels.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/post-type-labels.json", "title": "WP_Post_Type_Labels", "type": "object", diff --git a/schemas/properties/post-type-name.json b/schemas/properties/post-type-name.json index 26f225e..aac56ab 100644 --- a/schemas/properties/post-type-name.json +++ b/schemas/properties/post-type-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/post-type-name.json", "title": "WP_Post_Type_Name", "type": "string", diff --git a/schemas/properties/post-type-rewrite.json b/schemas/properties/post-type-rewrite.json index 29fd024..8440126 100644 --- a/schemas/properties/post-type-rewrite.json +++ b/schemas/properties/post-type-rewrite.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/post-type-rewrite.json", "title": "WP_Post_Type_Rewrite", "type": "object", diff --git a/schemas/properties/taxonomy-caps.json b/schemas/properties/taxonomy-caps.json index 0b95b64..a21db09 100644 --- a/schemas/properties/taxonomy-caps.json +++ b/schemas/properties/taxonomy-caps.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/taxonomy-caps.json", "title": "WP_Taxonomy_Caps", "type": "object", diff --git a/schemas/properties/taxonomy-labels.json b/schemas/properties/taxonomy-labels.json index 1c4da20..5068def 100644 --- a/schemas/properties/taxonomy-labels.json +++ b/schemas/properties/taxonomy-labels.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/taxonomy-labels.json", "title": "WP_Taxonomy_Labels", "type": "object", diff --git a/schemas/properties/taxonomy-name.json b/schemas/properties/taxonomy-name.json index b9b8d36..d6befc9 100644 --- a/schemas/properties/taxonomy-name.json +++ b/schemas/properties/taxonomy-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/taxonomy-name.json", "title": "WP_Taxonomy_Name", "type": "string", diff --git a/schemas/properties/taxonomy-rewrite.json b/schemas/properties/taxonomy-rewrite.json index 354bfeb..5ac0777 100644 --- a/schemas/properties/taxonomy-rewrite.json +++ b/schemas/properties/taxonomy-rewrite.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/taxonomy-rewrite.json", "title": "WP_Taxonomy_Rewrite", "type": "object", diff --git a/schemas/properties/user-cap-name.json b/schemas/properties/user-cap-name.json index 5d953b7..4d9213c 100644 --- a/schemas/properties/user-cap-name.json +++ b/schemas/properties/user-cap-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/user-cap-name.json", "title": "WP_User_Cap_Name", "type": "string", diff --git a/schemas/properties/user-caps.json b/schemas/properties/user-caps.json index 9d10081..71de575 100644 --- a/schemas/properties/user-caps.json +++ b/schemas/properties/user-caps.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/user-caps.json", "title": "WP_User_Caps", "type": "object", diff --git a/schemas/properties/user-data.json b/schemas/properties/user-data.json index 634e6ed..0f7c4a6 100644 --- a/schemas/properties/user-data.json +++ b/schemas/properties/user-data.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/user-data.json", "title": "WP_User_Data", "type": "object", diff --git a/schemas/properties/user-role-name.json b/schemas/properties/user-role-name.json index aa13d67..add0a5a 100644 --- a/schemas/properties/user-role-name.json +++ b/schemas/properties/user-role-name.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/properties/user-role-name.json", "title": "WP_User_Role_Name", "type": "string", diff --git a/schemas/query.json b/schemas/query.json index 29d6dc9..8b2c925 100644 --- a/schemas/query.json +++ b/schemas/query.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/query.json", "title": "WP_Query", "description": "The WordPress Query class.", diff --git a/schemas/rest-api/application-password.json b/schemas/rest-api/application-password.json index 19572e4..951fea5 100644 --- a/schemas/rest-api/application-password.json +++ b/schemas/rest-api/application-password.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/application-password.json", "title": "WP_REST_API_Application_Password", "description": "A user application password in a REST API context.", diff --git a/schemas/rest-api/attachment.json b/schemas/rest-api/attachment.json index 1a1f3ff..acbc2e2 100644 --- a/schemas/rest-api/attachment.json +++ b/schemas/rest-api/attachment.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/attachment.json", "title": "WP_REST_API_Attachment", "description": "A media attachment object in a REST API context.", @@ -194,7 +194,7 @@ { "allOf": [ { - "$ref": "post.json#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } ] }, diff --git a/schemas/rest-api/block-directory-item.json b/schemas/rest-api/block-directory-item.json index ed3a594..8eaf837 100644 --- a/schemas/rest-api/block-directory-item.json +++ b/schemas/rest-api/block-directory-item.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/block-directory-item.json", "title": "WP_REST_API_Block_Directory_Item", "description": "A block directory search result in a REST API context.", diff --git a/schemas/rest-api/block-pattern-category.json b/schemas/rest-api/block-pattern-category.json index b8e9724..032471a 100644 --- a/schemas/rest-api/block-pattern-category.json +++ b/schemas/rest-api/block-pattern-category.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/block-pattern.json b/schemas/rest-api/block-pattern.json index 17c36df..e9002e1 100644 --- a/schemas/rest-api/block-pattern.json +++ b/schemas/rest-api/block-pattern.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/block-type.json b/schemas/rest-api/block-type.json index 0f68b89..add97e9 100644 --- a/schemas/rest-api/block-type.json +++ b/schemas/rest-api/block-type.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/block-type.json", "title": "WP_REST_API_Block_Type", "description": "A block type object in a REST API context.", diff --git a/schemas/rest-api/block.json b/schemas/rest-api/block.json index 19be0a7..5873e16 100644 --- a/schemas/rest-api/block.json +++ b/schemas/rest-api/block.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/block.json", "title": "WP_REST_API_Block", "description": "A reusable block object in a REST API context.", diff --git a/schemas/rest-api/category.json b/schemas/rest-api/category.json index 9e23be1..579faf4 100644 --- a/schemas/rest-api/category.json +++ b/schemas/rest-api/category.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/category.json", "title": "WP_REST_API_Category", "description": "A post category object in a REST API context.", diff --git a/schemas/rest-api/collections/application-passwords.json b/schemas/rest-api/collections/application-passwords.json index 78ef31f..be947ff 100644 --- a/schemas/rest-api/collections/application-passwords.json +++ b/schemas/rest-api/collections/application-passwords.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/application-passwords.json", "title": "WP_REST_API_Application_Passwords", "description": "A collection of user application passwords in a REST API context.", diff --git a/schemas/rest-api/collections/block-directory-items.json b/schemas/rest-api/collections/block-directory-items.json index a18e829..de0cd6d 100644 --- a/schemas/rest-api/collections/block-directory-items.json +++ b/schemas/rest-api/collections/block-directory-items.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/block-directory-items.json", "title": "WP_REST_API_Block_Directory_Items", "description": "A collection of block directory search results in a REST API context.", diff --git a/schemas/rest-api/collections/block-pattern-categories.json b/schemas/rest-api/collections/block-pattern-categories.json index 42919db..fc21c04 100644 --- a/schemas/rest-api/collections/block-pattern-categories.json +++ b/schemas/rest-api/collections/block-pattern-categories.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/collections/block-patterns.json b/schemas/rest-api/collections/block-patterns.json index 673caab..18ebc0e 100644 --- a/schemas/rest-api/collections/block-patterns.json +++ b/schemas/rest-api/collections/block-patterns.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/collections/block-types.json b/schemas/rest-api/collections/block-types.json index 2162604..7590a26 100644 --- a/schemas/rest-api/collections/block-types.json +++ b/schemas/rest-api/collections/block-types.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/block-types.json", "title": "WP_REST_API_Block_Types", "description": "A collection of block type objects in a REST API context.", diff --git a/schemas/rest-api/collections/blocks.json b/schemas/rest-api/collections/blocks.json index 7847640..61ecfcb 100644 --- a/schemas/rest-api/collections/blocks.json +++ b/schemas/rest-api/collections/blocks.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/blocks.json", "title": "WP_REST_API_Blocks", "description": "A collection of reusable block objects in a REST API context.", diff --git a/schemas/rest-api/collections/categories.json b/schemas/rest-api/collections/categories.json index 466e40f..bdbe94d 100644 --- a/schemas/rest-api/collections/categories.json +++ b/schemas/rest-api/collections/categories.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/categories.json", "title": "WP_REST_API_Categories", "description": "A collection of post category objects in a REST API context.", diff --git a/schemas/rest-api/collections/comments.json b/schemas/rest-api/collections/comments.json index 390f8bd..9db5ae9 100644 --- a/schemas/rest-api/collections/comments.json +++ b/schemas/rest-api/collections/comments.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/comments.json", "title": "WP_REST_API_Comments", "description": "A collection of comment objects in a REST API context.", diff --git a/schemas/rest-api/collections/font-collections.json b/schemas/rest-api/collections/font-collections.json index a865fc1..98e6b15 100644 --- a/schemas/rest-api/collections/font-collections.json +++ b/schemas/rest-api/collections/font-collections.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/collections/font-faces.json b/schemas/rest-api/collections/font-faces.json index caef5e7..11a0bdd 100644 --- a/schemas/rest-api/collections/font-faces.json +++ b/schemas/rest-api/collections/font-faces.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/collections/font-families.json b/schemas/rest-api/collections/font-families.json index 7a1a895..2204ce4 100644 --- a/schemas/rest-api/collections/font-families.json +++ b/schemas/rest-api/collections/font-families.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/collections/media.json b/schemas/rest-api/collections/media.json index 117a501..8265415 100644 --- a/schemas/rest-api/collections/media.json +++ b/schemas/rest-api/collections/media.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/media.json", "title": "WP_REST_API_Attachments", "description": "A collection of media attachment objects in a REST API context.", diff --git a/schemas/rest-api/collections/menu-items.json b/schemas/rest-api/collections/menu-items.json index bf97f3d..bf6c719 100644 --- a/schemas/rest-api/collections/menu-items.json +++ b/schemas/rest-api/collections/menu-items.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/menu-items.json", "title": "WP_REST_API_Menu_Items", "description": "A collection of menu items in a REST API context.", diff --git a/schemas/rest-api/collections/menu-locations.json b/schemas/rest-api/collections/menu-locations.json index 95b1a36..3c07252 100644 --- a/schemas/rest-api/collections/menu-locations.json +++ b/schemas/rest-api/collections/menu-locations.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/menu-locations.json", "title": "WP_REST_API_Menu_Locations", "description": "A collection of menu locations in a REST API context.", diff --git a/schemas/rest-api/collections/menus.json b/schemas/rest-api/collections/menus.json index bddb4c9..f30567e 100644 --- a/schemas/rest-api/collections/menus.json +++ b/schemas/rest-api/collections/menus.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/menus.json", "title": "WP_REST_API_Menus", "description": "A collection of menus in a REST API context.", diff --git a/schemas/rest-api/collections/pages.json b/schemas/rest-api/collections/pages.json index e1f2435..3e27c51 100644 --- a/schemas/rest-api/collections/pages.json +++ b/schemas/rest-api/collections/pages.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/pages.json", "title": "WP_REST_API_Pages", "description": "A collection of page objects in a REST API context.", diff --git a/schemas/rest-api/collections/posts.json b/schemas/rest-api/collections/posts.json index 9c4ad6a..a65f8e7 100644 --- a/schemas/rest-api/collections/posts.json +++ b/schemas/rest-api/collections/posts.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/posts.json", "title": "WP_REST_API_Posts", "description": "A collection of post objects in a REST API context.", diff --git a/schemas/rest-api/collections/revisions.json b/schemas/rest-api/collections/revisions.json index 2c34ff7..3e5fda1 100644 --- a/schemas/rest-api/collections/revisions.json +++ b/schemas/rest-api/collections/revisions.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/revisions.json", "title": "WP_REST_API_Revisions", "description": "A collection of post revision objects in a REST API context.", diff --git a/schemas/rest-api/collections/search-results.json b/schemas/rest-api/collections/search-results.json index 8e8c3e3..0d8225f 100644 --- a/schemas/rest-api/collections/search-results.json +++ b/schemas/rest-api/collections/search-results.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/search-results.json", "title": "WP_REST_API_Search_Results", "description": "A collection of search result objects in a REST API context.", diff --git a/schemas/rest-api/collections/statuses.json b/schemas/rest-api/collections/statuses.json index c98edd0..3acbd5d 100644 --- a/schemas/rest-api/collections/statuses.json +++ b/schemas/rest-api/collections/statuses.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/statuses.json", "title": "WP_REST_API_Statuses", "description": "A collection of post status objects in a REST API context.", diff --git a/schemas/rest-api/collections/tags.json b/schemas/rest-api/collections/tags.json index dc7d7f6..201f53a 100644 --- a/schemas/rest-api/collections/tags.json +++ b/schemas/rest-api/collections/tags.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/tags.json", "title": "WP_REST_API_Tags", "description": "A collection of post tag objects in a REST API context.", diff --git a/schemas/rest-api/collections/taxonomies.json b/schemas/rest-api/collections/taxonomies.json index e5eac05..5bf823a 100644 --- a/schemas/rest-api/collections/taxonomies.json +++ b/schemas/rest-api/collections/taxonomies.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/taxonomies.json", "title": "WP_REST_API_Taxonomies", "description": "A collection of taxonomy objects in a REST API context.", diff --git a/schemas/rest-api/collections/terms.json b/schemas/rest-api/collections/terms.json index 072f7cc..44b4951 100644 --- a/schemas/rest-api/collections/terms.json +++ b/schemas/rest-api/collections/terms.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/terms.json", "title": "WP_REST_API_Terms", "description": "A collection of term objects in a REST API context.", diff --git a/schemas/rest-api/collections/types.json b/schemas/rest-api/collections/types.json index cb4e5a7..20b7804 100644 --- a/schemas/rest-api/collections/types.json +++ b/schemas/rest-api/collections/types.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/types.json", "title": "WP_REST_API_Types", "description": "A collection of post type objects in a REST API context.", diff --git a/schemas/rest-api/collections/users.json b/schemas/rest-api/collections/users.json index 5232dcc..e4cddfc 100644 --- a/schemas/rest-api/collections/users.json +++ b/schemas/rest-api/collections/users.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/collections/users.json", "title": "WP_REST_API_Users", "description": "A collection of user objects in a REST API context.", diff --git a/schemas/rest-api/comment.json b/schemas/rest-api/comment.json index a517824..a32db57 100644 --- a/schemas/rest-api/comment.json +++ b/schemas/rest-api/comment.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/comment.json", "title": "WP_REST_API_Comment", "description": "A comment object in a REST API context.", @@ -143,7 +143,7 @@ "description": "The ID of the associated post object.", "allOf": [ { - "$ref": "post.json#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } ] }, diff --git a/schemas/rest-api/error.json b/schemas/rest-api/error.json index 2eab5e2..33a8c30 100644 --- a/schemas/rest-api/error.json +++ b/schemas/rest-api/error.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/error.json", "title": "WP_REST_API_Error", "description": "A REST API error response.", diff --git a/schemas/rest-api/font-collection.json b/schemas/rest-api/font-collection.json index 37aa8b5..eda1db7 100644 --- a/schemas/rest-api/font-collection.json +++ b/schemas/rest-api/font-collection.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/font-face.json b/schemas/rest-api/font-face.json index a118a60..6c7465f 100644 --- a/schemas/rest-api/font-face.json +++ b/schemas/rest-api/font-face.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/font-family.json b/schemas/rest-api/font-family.json index f8c5414..e7510ae 100644 --- a/schemas/rest-api/font-family.json +++ b/schemas/rest-api/font-family.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/menu-item.json b/schemas/rest-api/menu-item.json index a11121c..81be1a2 100644 --- a/schemas/rest-api/menu-item.json +++ b/schemas/rest-api/menu-item.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/menu-item.json", "title": "WP_REST_API_Menu_Item", "description": "A menu item in a REST API context.", diff --git a/schemas/rest-api/menu-location.json b/schemas/rest-api/menu-location.json index 2d99d14..e516c7c 100644 --- a/schemas/rest-api/menu-location.json +++ b/schemas/rest-api/menu-location.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/menu-location.json", "title": "WP_REST_API_Menu_Location", "description": "A menu location in a REST API context.", diff --git a/schemas/rest-api/menu.json b/schemas/rest-api/menu.json index 4c01e68..57ca4a4 100644 --- a/schemas/rest-api/menu.json +++ b/schemas/rest-api/menu.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/menu.json", "title": "WP_REST_API_Menu", "description": "A menu in a REST API context.", diff --git a/schemas/rest-api/page.json b/schemas/rest-api/page.json index b38059e..317ae34 100644 --- a/schemas/rest-api/page.json +++ b/schemas/rest-api/page.json @@ -1,14 +1,57 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/page.json", "title": "WP_REST_API_Page", "description": "A page object in a REST API context.", "type": "object", "allOf": [ { - "$ref": "post.json" + "$ref": "partials/post/common.json" + }, + { + "$ref": "./partials/post/author.json" + }, + { + "$ref": "./partials/post/public.json" + }, + { + "$ref": "./partials/post/comments.json" + }, + { + "$ref": "./partials/post/excerpt.json" } ], + "properties": { + "_embedded": { + "description": "The embedded representation of relations. Only present when the '_embed' query parameter is set.", + "type": "object", + "required": [ + "author" + ], + "properties": { + "author": { + "description": "The author of the page.", + "type": "array" + }, + "replies": { + "description": "The replies to the page (comments, pingbacks, trackbacks).", + "type": "array" + }, + "wp:term": { + "description": "The taxonomy terms for the page.", + "type": "array" + }, + "wp:featuredmedia": { + "description": "The featured image page.", + "type": "array" + }, + "up": { + "description": "The parent page.", + "type": "array" + } + } + } + }, "links": [ { "rel": "self", @@ -16,7 +59,7 @@ "hrefSchema": { "properties": { "id": { - "$ref": "post.json#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } } }, @@ -40,7 +83,7 @@ "hrefSchema": { "properties": { "author": { - "$ref": "post.json#/properties/author" + "$ref": "partials/post/author.json#/properties/author" } } }, @@ -54,7 +97,7 @@ "hrefSchema": { "properties": { "id": { - "$ref": "post.json#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } } }, @@ -71,7 +114,7 @@ "hrefSchema": { "properties": { "id": { - "$ref": "post.json#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } } }, diff --git a/schemas/rest-api/partials/post/author.json b/schemas/rest-api/partials/post/author.json new file mode 100644 index 0000000..34ce58f --- /dev/null +++ b/schemas/rest-api/partials/post/author.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/partials/post/author.json", + "title": "WP_REST_API_Partial_Post_Author", + "description": "Hello.", + "type": "object", + "required": [ + "author" + ], + "properties": { + "author": { + "description": "The ID for the author of the post.", + "allOf": [ + { + "$ref": "../../user.json#/properties/id" + } + ] + } + }, + "links": [ + { + "rel": "author", + "href": "/wp/v2/users/{author}", + "hrefSchema": { + "properties": { + "author": { + "$ref": "#/properties/author" + } + } + }, + "targetSchema": { + "$ref": "../../user.json" + } + } + ] +} diff --git a/schemas/rest-api/partials/post/comments.json b/schemas/rest-api/partials/post/comments.json new file mode 100644 index 0000000..d0405c7 --- /dev/null +++ b/schemas/rest-api/partials/post/comments.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/partials/post/comments.json", + "title": "WP_REST_API_Partial_Post_Comments", + "description": "Properties for post types that support comments", + "type": "object", + "required": [ + "comment_status", + "ping_status" + ], + "properties": { + "comment_status": { + "description": "Whether or not comments are open on the post.", + "oneOf": [ + { + "$ref": "../../../properties/post-comment-status-name.json" + } + ] + }, + "ping_status": { + "description": "Whether or not the post can be pinged.", + "oneOf": [ + { + "$ref": "../../../properties/post-comment-status-name.json" + } + ] + } + } +} diff --git a/schemas/rest-api/partials/post/common.json b/schemas/rest-api/partials/post/common.json new file mode 100644 index 0000000..2fbb577 --- /dev/null +++ b/schemas/rest-api/partials/post/common.json @@ -0,0 +1,237 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/partials/post/common.json", + "title": "WP_REST_API_Partial_Post_Common", + "description": "Common post properties", + "type": "object", + "required": [ + "date", + "date_gmt", + "guid", + "id", + "link", + "modified", + "modified_gmt", + "slug", + "status", + "type", + "title", + "content", + "_links" + ], + "properties": { + "date": { + "description": "The date the post was published, in the site's timezone.", + "oneOf": [ + { + "$ref": "../../properties/date-time.json" + } + ] + }, + "date_gmt": { + "description": "The date the post was published, as GMT.", + "oneOf": [ + { + "$ref": "../../properties/date-time.json" + } + ] + }, + "guid": { + "readOnly": true, + "description": "The globally unique identifier for the post.", + "type": "object", + "required": [ + "rendered" + ], + "properties": { + "raw": { + "readOnly": true, + "description": "GUID for the post, as it exists in the database. Only present when using the 'edit' context.", + "type": "string" + }, + "rendered": { + "readOnly": true, + "description": "GUID for the post, transformed for display.", + "type": "string" + } + }, + "additionalProperties": false + }, + "id": { + "readOnly": true, + "description": "Unique identifier for the post.", + "type": "integer" + }, + "link": { + "readOnly": true, + "description": "URL to the post.", + "type": "string", + "format": "uri" + }, + "modified": { + "readOnly": true, + "description": "The date the post was last modified, in the site's timezone.", + "oneOf": [ + { + "$ref": "../../properties/date-time.json" + } + ] + }, + "modified_gmt": { + "readOnly": true, + "description": "The date the post was last modified, as GMT.", + "oneOf": [ + { + "$ref": "../../properties/date-time.json" + } + ] + }, + "slug": { + "description": "An alphanumeric identifier for the post unique to its type.", + "type": "string" + }, + "status": { + "description": "A named status for the post.", + "anyOf": [ + { + "$ref": "../../../properties/post-status-name.json" + }, + { + "type": "string" + } + ] + }, + "type": { + "readOnly": true, + "description": "Type of Post for the post.", + "anyOf": [ + { + "$ref": "../../../properties/post-type-name.json" + }, + { + "type": "string" + } + ] + }, + "password": { + "description": "A password to protect access to the content and excerpt. Only present when using the 'edit' context.", + "type": "string" + }, + "parent": { + "description": "The ID for the parent of the post. Only present for hierarchical post types.", + "allOf": [ + { + "$ref": "#/properties/id" + } + ] + }, + "menu_order": { + "description": "A field used for ordering posts.", + "type": "integer" + }, + "title": { + "description": "The title for the post.", + "type": "object", + "required": [ + "rendered" + ], + "properties": { + "raw": { + "description": "Title for the post, as it exists in the database. Only present when using the 'edit' context.", + "type": "string" + }, + "rendered": { + "readOnly": true, + "contentMediaType": "text/html", + "description": "HTML title for the post, transformed for display.", + "type": "string" + } + }, + "additionalProperties": false + }, + "content": { + "description": "The content for the post.", + "type": "object", + "required": [ + "rendered", + "protected" + ], + "properties": { + "raw": { + "description": "Content for the post, 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, transformed for display.", + "contentMediaType": "text/html", + "type": "string" + }, + "block_version": { + "readOnly": true, + "description": "Version of the content block format used by the post. Only present when using the 'edit' context.", + "type": "integer" + }, + "protected": { + "readOnly": true, + "description": "Whether the content is protected with a password.", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "featured_media": { + "description": "The ID of the featured media for the post.", + "allOf": [ + { + "$ref": "#/properties/id" + } + ] + }, + "format": { + "description": "The format for the post.", + "oneOf": [ + { + "$ref": "../../../properties/post-format-name.json" + } + ] + }, + "meta": { + "description": "Meta fields.", + "oneOf": [ + { + "$ref": "../../../../schema.json#/definitions/EmptyArray" + }, + { + "type": "object" + } + ] + }, + "sticky": { + "description": "Whether or not the post should be treated as sticky. Only present for the 'post' post type.", + "type": "boolean" + }, + "template": { + "description": "The theme file to use to display the post.", + "type": "string" + }, + "categories": { + "description": "The terms assigned to the post in the category taxonomy. Only present for post types that support categories.", + "type": "array", + "items": { + "$ref": "../../term.json#/properties/id" + } + }, + "tags": { + "description": "The terms assigned to the post in the post_tag taxonomy. Only present for post types that support tags.", + "type": "array", + "items": { + "$ref": "../../term.json#/properties/id" + } + }, + "_links": { + "$ref": "../../properties/object-links.json" + } + } +} diff --git a/schemas/rest-api/partials/post/excerpt.json b/schemas/rest-api/partials/post/excerpt.json new file mode 100644 index 0000000..6da1d48 --- /dev/null +++ b/schemas/rest-api/partials/post/excerpt.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/partials/post/excerpt.json", + "title": "WP_REST_API_Partial_Post_Excerpt", + "description": "Properties for post types that support an excerpt", + "type": "object", + "required": [ + "excerpt" + ], + "properties": { + "excerpt": { + "description": "The excerpt for the post.", + "type": "object", + "required": [ + "rendered", + "protected" + ], + "properties": { + "raw": { + "description": "Excerpt for the post, as it exists in the database. Only present when using the 'edit' context.", + "contentMediaType": "text/html", + "type": "string" + }, + "rendered": { + "readOnly": true, + "description": "HTML excerpt for the post, transformed for display.", + "contentMediaType": "text/html", + "type": "string" + }, + "protected": { + "readOnly": true, + "description": "Whether the excerpt is protected with a password.", + "type": "boolean" + } + }, + "additionalProperties": false + } + } +} diff --git a/schemas/rest-api/partials/post/public.json b/schemas/rest-api/partials/post/public.json new file mode 100644 index 0000000..acd33e7 --- /dev/null +++ b/schemas/rest-api/partials/post/public.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", + "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/partials/post/public.json", + "title": "WP_REST_API_Partial_Post_Public", + "description": "Properties for public post types", + "type": "object", + "required": [ + "class_list" + ], + "properties": { + "permalink_template": { + "readOnly": true, + "description": "Permalink template for the post. Only present when using the 'edit' context and the post type is public.", + "type": "string" + }, + "generated_slug": { + "readOnly": true, + "description": "Slug automatically generated from the post 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" + } + } + } +} diff --git a/schemas/rest-api/post.json b/schemas/rest-api/post.json index d79fdbd..1190144 100644 --- a/schemas/rest-api/post.json +++ b/schemas/rest-api/post.json @@ -1,313 +1,27 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/post.json", "title": "WP_REST_API_Post", "description": "A post object in a REST API context.", "type": "object", - "required": [ - "date", - "date_gmt", - "guid", - "id", - "link", - "modified", - "modified_gmt", - "slug", - "status", - "type", - "class_list", - "title", - "content", - "author", - "excerpt", - "comment_status", - "ping_status", - "meta", - "_links" - ], - "properties": { - "date": { - "description": "The date the post was published, in the site's timezone.", - "oneOf": [ - { - "$ref": "properties/date-time.json" - } - ] - }, - "date_gmt": { - "description": "The date the post was published, as GMT.", - "oneOf": [ - { - "$ref": "properties/date-time.json" - } - ] - }, - "guid": { - "readOnly": true, - "description": "The globally unique identifier for the post.", - "type": "object", - "required": [ - "rendered" - ], - "properties": { - "raw": { - "readOnly": true, - "description": "GUID for the post, as it exists in the database. Only present when using the 'edit' context.", - "type": "string" - }, - "rendered": { - "readOnly": true, - "description": "GUID for the post, transformed for display.", - "type": "string" - } - }, - "additionalProperties": false - }, - "id": { - "readOnly": true, - "description": "Unique identifier for the post.", - "type": "integer" - }, - "link": { - "readOnly": true, - "description": "URL to the post.", - "type": "string", - "format": "uri" - }, - "modified": { - "readOnly": true, - "description": "The date the post was last modified, in the site's timezone.", - "oneOf": [ - { - "$ref": "properties/date-time.json" - } - ] - }, - "modified_gmt": { - "readOnly": true, - "description": "The date the post was last modified, as GMT.", - "oneOf": [ - { - "$ref": "properties/date-time.json" - } - ] - }, - "slug": { - "description": "An alphanumeric identifier for the post unique to its type.", - "type": "string" - }, - "status": { - "description": "A named status for the post.", - "anyOf": [ - { - "$ref": "../properties/post-status-name.json" - }, - { - "type": "string" - } - ] - }, - "type": { - "readOnly": true, - "description": "Type of Post for the post.", - "anyOf": [ - { - "$ref": "../properties/post-type-name.json" - }, - { - "type": "string" - } - ] - }, - "password": { - "description": "A password to protect access to the content and excerpt. Only present when using the 'edit' context.", - "type": "string" - }, - "permalink_template": { - "readOnly": true, - "description": "Permalink template for the post. Only present when using the 'edit' context and the post type is public.", - "type": "string" - }, - "generated_slug": { - "readOnly": true, - "description": "Slug automatically generated from the post title. Only present when using the 'edit' context and the post type is public.", - "type": "string" - }, - "parent": { - "description": "The ID for the parent of the post. Only present for hierarchical post types.", - "allOf": [ - { - "$ref": "#/properties/id" - } - ] - }, - "menu_order": { - "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", - "required": [ - "rendered" - ], - "properties": { - "raw": { - "description": "Title for the post, as it exists in the database. Only present when using the 'edit' context.", - "type": "string" - }, - "rendered": { - "readOnly": true, - "contentMediaType": "text/html", - "description": "HTML title for the post, transformed for display.", - "type": "string" - } - }, - "additionalProperties": false - }, - "content": { - "description": "The content for the post.", - "type": "object", - "required": [ - "rendered", - "protected" - ], - "properties": { - "raw": { - "description": "Content for the post, 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, transformed for display.", - "contentMediaType": "text/html", - "type": "string" - }, - "block_version": { - "readOnly": true, - "description": "Version of the content block format used by the post. Only present when using the 'edit' context.", - "type": "integer" - }, - "protected": { - "readOnly": true, - "description": "Whether the content is protected with a password.", - "type": "boolean" - } - }, - "additionalProperties": false - }, - "author": { - "description": "The ID for the author of the post.", - "allOf": [ - { - "$ref": "user.json#/properties/id" - } - ] - }, - "excerpt": { - "description": "The excerpt for the post.", - "type": "object", - "required": [ - "rendered", - "protected" - ], - "properties": { - "raw": { - "description": "Excerpt for the post, as it exists in the database. Only present when using the 'edit' context.", - "contentMediaType": "text/html", - "type": "string" - }, - "rendered": { - "readOnly": true, - "description": "HTML excerpt for the post, transformed for display.", - "contentMediaType": "text/html", - "type": "string" - }, - "protected": { - "readOnly": true, - "description": "Whether the excerpt is protected with a password.", - "type": "boolean" - } - }, - "additionalProperties": false - }, - "featured_media": { - "description": "The ID of the featured media for the post.", - "allOf": [ - { - "$ref": "#/properties/id" - } - ] - }, - "comment_status": { - "description": "Whether or not comments are open on the post.", - "oneOf": [ - { - "$ref": "../properties/post-comment-status-name.json" - } - ] - }, - "ping_status": { - "description": "Whether or not the post can be pinged.", - "oneOf": [ - { - "$ref": "../properties/post-comment-status-name.json" - } - ] - }, - "format": { - "description": "The format for the post.", - "oneOf": [ - { - "$ref": "../properties/post-format-name.json" - } - ] - }, - "meta": { - "description": "Meta fields.", - "oneOf": [ - { - "$ref": "../../schema.json#/definitions/EmptyArray" - }, - { - "type": "object" - } - ] - }, - "sticky": { - "description": "Whether or not the post should be treated as sticky. Only present for the 'post' post type.", - "type": "boolean" - }, - "template": { - "description": "The theme file to use to display the post.", - "type": "string" + "allOf": [ + { + "$ref": "./partials/post/common.json" }, - "categories": { - "description": "The terms assigned to the post in the category taxonomy. Only present for post types that support categories.", - "type": "array", - "items": { - "$ref": "term.json#/properties/id" - } + { + "$ref": "./partials/post/author.json" }, - "tags": { - "description": "The terms assigned to the post in the post_tag taxonomy. Only present for post types that support tags.", - "type": "array", - "items": { - "$ref": "term.json#/properties/id" - } + { + "$ref": "./partials/post/public.json" }, - "_links": { - "$ref": "properties/object-links.json" + { + "$ref": "./partials/post/comments.json" }, + { + "$ref": "./partials/post/excerpt.json" + } + ], + "properties": { "_embedded": { "description": "The embedded representation of relations. Only present when the '_embed' query parameter is set.", "type": "object", @@ -345,7 +59,7 @@ "hrefSchema": { "properties": { "id": { - "$ref": "#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } } }, @@ -363,27 +77,13 @@ } } }, - { - "rel": "author", - "href": "/wp/v2/users/{author}", - "hrefSchema": { - "properties": { - "author": { - "$ref": "#/properties/author" - } - } - }, - "targetSchema": { - "$ref": "user.json" - } - }, { "rel": "replies", "href": "/wp/v2/comments?post={id}", "hrefSchema": { "properties": { "id": { - "$ref": "#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } } }, @@ -400,7 +100,7 @@ "hrefSchema": { "properties": { "id": { - "$ref": "#/properties/id" + "$ref": "partials/post/common.json#/properties/id" } } }, diff --git a/schemas/rest-api/properties/date-time-utc.json b/schemas/rest-api/properties/date-time-utc.json index 02e1cf8..f0c23fb 100644 --- a/schemas/rest-api/properties/date-time-utc.json +++ b/schemas/rest-api/properties/date-time-utc.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/properties/date-time-utc.json", "title": "WP_REST_API_Date_Time_UTC", "description": "UTC timestamp in IETF RFC 3339 date-time format (`YYYY-MM-DDThh:mm:ss+00:00`).", diff --git a/schemas/rest-api/properties/date-time.json b/schemas/rest-api/properties/date-time.json index 6017309..978a4c8 100644 --- a/schemas/rest-api/properties/date-time.json +++ b/schemas/rest-api/properties/date-time.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/properties/date-time.json", "title": "WP_REST_API_Date_Time", "description": "Timestamp in IETF RFC 3339 date-time format minus the timezone identifier (`YYYY-MM-DDThh:mm:ss`).", diff --git a/schemas/rest-api/properties/font-face.json b/schemas/rest-api/properties/font-face.json index 2587799..e50adc1 100644 --- a/schemas/rest-api/properties/font-face.json +++ b/schemas/rest-api/properties/font-face.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/properties/font-family-settings.json b/schemas/rest-api/properties/font-family-settings.json index d66ee7d..39b65f8 100644 --- a/schemas/rest-api/properties/font-family-settings.json +++ b/schemas/rest-api/properties/font-family-settings.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/rest-api/properties/http-status-code.json b/schemas/rest-api/properties/http-status-code.json index ce4cc77..0cb59c1 100644 --- a/schemas/rest-api/properties/http-status-code.json +++ b/schemas/rest-api/properties/http-status-code.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/properties/http-status-code.json", "title": "WP_Http_Status_Code", "type": "integer", diff --git a/schemas/rest-api/properties/object-links.json b/schemas/rest-api/properties/object-links.json index ddfd831..ae037b6 100644 --- a/schemas/rest-api/properties/object-links.json +++ b/schemas/rest-api/properties/object-links.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/properties/object-links.json", "title": "WP_REST_API_Object_Links", "description": "The relations for the object and its properties.", diff --git a/schemas/rest-api/rendered-block.json b/schemas/rest-api/rendered-block.json index d395252..7be2a2a 100644 --- a/schemas/rest-api/rendered-block.json +++ b/schemas/rest-api/rendered-block.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/rendered-block.json", "title": "WP_REST_API_Rendered_Block", "description": "A rendered dynamic block in a REST API context. Only accessible with the 'edit' context.", diff --git a/schemas/rest-api/revision.json b/schemas/rest-api/revision.json index 0d817ee..b20c3e7 100644 --- a/schemas/rest-api/revision.json +++ b/schemas/rest-api/revision.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/revision.json", "title": "WP_REST_API_Revision", "description": "A post revision object in a REST API context.", diff --git a/schemas/rest-api/search-result.json b/schemas/rest-api/search-result.json index 2e40e00..e852cb6 100644 --- a/schemas/rest-api/search-result.json +++ b/schemas/rest-api/search-result.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/search-result.json", "title": "WP_REST_API_Search_Result", "description": "A search result in a REST API context.", diff --git a/schemas/rest-api/settings.json b/schemas/rest-api/settings.json index 1f0966a..4285b49 100644 --- a/schemas/rest-api/settings.json +++ b/schemas/rest-api/settings.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/settings.json", "title": "WP_REST_API_Settings", "description": "Site settings in a REST API context.", diff --git a/schemas/rest-api/status.json b/schemas/rest-api/status.json index ffba2e2..706a4c8 100644 --- a/schemas/rest-api/status.json +++ b/schemas/rest-api/status.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/status.json", "title": "WP_REST_API_Status", "description": "A post status object in a REST API context.", diff --git a/schemas/rest-api/tag.json b/schemas/rest-api/tag.json index e612592..6402508 100644 --- a/schemas/rest-api/tag.json +++ b/schemas/rest-api/tag.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/tag.json", "title": "WP_REST_API_Tag", "description": "A post tag object in a REST API context.", diff --git a/schemas/rest-api/taxonomy.json b/schemas/rest-api/taxonomy.json index 6a6326f..c4318ba 100644 --- a/schemas/rest-api/taxonomy.json +++ b/schemas/rest-api/taxonomy.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/taxonomy.json", "title": "WP_REST_API_Taxonomy", "description": "A taxonomy in a REST API context.", diff --git a/schemas/rest-api/term.json b/schemas/rest-api/term.json index 8fb6098..8f5159f 100644 --- a/schemas/rest-api/term.json +++ b/schemas/rest-api/term.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/term.json", "title": "WP_REST_API_Term", "description": "A taxonomy term object in a REST API context.", diff --git a/schemas/rest-api/type.json b/schemas/rest-api/type.json index 3cb374c..7345cf3 100644 --- a/schemas/rest-api/type.json +++ b/schemas/rest-api/type.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/type.json", "title": "WP_REST_API_Type", "description": "A post type object in a REST API context.", diff --git a/schemas/rest-api/user.json b/schemas/rest-api/user.json index ae5ecf3..4e609c6 100644 --- a/schemas/rest-api/user.json +++ b/schemas/rest-api/user.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/rest-api/user.json", "title": "WP_REST_API_User", "description": "A user object in a REST API context.", diff --git a/schemas/role.json b/schemas/role.json index 690ab2a..c69e2d4 100644 --- a/schemas/role.json +++ b/schemas/role.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/role.json", "title": "WP_Role", "description": "Core class used to extend the user roles API.", diff --git a/schemas/screen.json b/schemas/screen.json index f6bd05c..76aadb5 100644 --- a/schemas/screen.json +++ b/schemas/screen.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/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.", diff --git a/schemas/site.json b/schemas/site.json index dcd8f47..533a652 100644 --- a/schemas/site.json +++ b/schemas/site.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/site.json", "title": "WP_Site", "description": "Core class used for interacting with a multisite site.", diff --git a/schemas/taxonomy.json b/schemas/taxonomy.json index a334097..257016f 100644 --- a/schemas/taxonomy.json +++ b/schemas/taxonomy.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/taxonomy.json", "title": "WP_Taxonomy", "description": "Core class used for interacting with taxonomies.", diff --git a/schemas/term.json b/schemas/term.json index 5b25721..6eeefd4 100644 --- a/schemas/term.json +++ b/schemas/term.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/term.json", "title": "WP_Term", "description": "Core class used to implement the WP_Term object.", diff --git a/schemas/user.json b/schemas/user.json index 577e24f..72b54a7 100644 --- a/schemas/user.json +++ b/schemas/user.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://raw.githubusercontent.com/johnbillion/wp-json-schemas/trunk/schemas/user.json", "title": "WP_User", "description": "Core class used to implement the WP_User object.", diff --git a/tests/bin/build-wp-types.sh b/tests/bin/build-wp-types.sh new file mode 100755 index 0000000..68647d4 --- /dev/null +++ b/tests/bin/build-wp-types.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# -e Exit immediately if a pipeline returns a non-zero status +# -o pipefail Produce a failure return code if any command errors +set -eo pipefail + +for file in schemas/rest-api/partials/**/*.json +do + ./node_modules/node-jq/bin/jq --tab '. + { "additionalProperties": false }' "$file" > tmp && mv tmp "$file" +done + +./node_modules/.bin/json2ts -i schema.json -o packages/wp-types/index.ts --style.trailingComma=all --style.useTabs + +for file in schemas/rest-api/partials/**/*.json +do + ./node_modules/node-jq/bin/jq --tab 'del(.additionalProperties)' "$file" > tmp && mv tmp "$file" +done + +cat packages/wp-types/append.ts >> packages/wp-types/index.ts +sed -i.bak 's/export interface WP_REST_API_Partial_/interface WP_REST_API_Partial_/g' packages/wp-types/index.ts +rm packages/wp-types/index.ts.bak diff --git a/tests/bin/test.sh b/tests/bin/test.sh index 3b6331f..49f8926 100755 --- a/tests/bin/test.sh +++ b/tests/bin/test.sh @@ -15,10 +15,10 @@ 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/external-schemas/hyper-schema.json -r schema.json -r $rflag -s "$file" -d "tests/data/$filename/*.json" + ./node_modules/.bin/ajv validate --spec=draft2019 --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") +IGNORE_FILES=("schemas/rest-api/error.json") for file in schemas/*.json do @@ -31,7 +31,7 @@ do then continue fi - ./node_modules/node-jq/bin/jq --tab '. + { "additionalProperties": false }' "$file" > tmp && mv tmp "$file" + ./node_modules/node-jq/bin/jq --tab '. + { "unevaluatedProperties": false }' "$file" > tmp && mv tmp "$file" done for file in schemas/rest-api/collections/*.json @@ -45,5 +45,5 @@ do then continue fi - ./node_modules/node-jq/bin/jq --tab 'del(.additionalProperties)' "$file" > tmp && mv tmp "$file" + ./node_modules/node-jq/bin/jq --tab 'del(.unevaluatedProperties)' "$file" > tmp && mv tmp "$file" done diff --git a/tests/external-schemas/hyper-schema.json b/tests/external-schemas/hyper-schema.json index 07f5057..3c28c1f 100644 --- a/tests/external-schemas/hyper-schema.json +++ b/tests/external-schemas/hyper-schema.json @@ -1,174 +1,133 @@ { - "$schema": "http://json-schema.org/draft-07/hyper-schema#", - "$id": "http://json-schema.org/draft-07/hyper-schema#", + "$schema": "https://json-schema.org/draft/2019-09/hyper-schema", + "$id": "https://json-schema.org/draft/2019-09/hyper-schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true, + "https://json-schema.org/draft/2019-09/vocab/hyper-schema": true + }, + "$recursiveAnchor": true, "title": "JSON Hyper-Schema", "allOf": [ { - "$ref": "http://json-schema.org/draft-07/schema#" - } - ], - "properties": { - "additionalItems": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#" - } - ] + "$ref": "https://json-schema.org/draft/2019-09/schema" }, - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#" - } - ] - }, - "dependencies": { - "additionalProperties": { - "anyOf": [ - { - "$ref": "#" - }, - { - "type": "array" - } - ] - } - }, - "items": { - "anyOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/schemaArray" - } - ] - }, - "definitions": { - "additionalProperties": { - "$ref": "#" - } - }, - "patternProperties": { - "additionalProperties": { - "$ref": "#" - } - }, - "properties": { - "additionalProperties": { - "$ref": "#" - } - }, - "allOf": { - "$ref": "#/definitions/schemaArray" - }, - "anyOf": { - "$ref": "#/definitions/schemaArray" - }, - "oneOf": { - "$ref": "#/definitions/schemaArray" - }, - "not": { - "$ref": "#" - }, - "links": { - "type": "array", - "items": { - "$ref": "#/definitions/linkDescription" - } - }, - "fragmentResolution": { - "type": "string" - }, - "media": { - "type": "object", - "properties": { - "type": { - "description": "A media type, as described in RFC 2046", - "type": "string" - }, - "binaryEncoding": { - "description": "A content encoding scheme, as described in RFC 2045", - "type": "string" - } - } - }, - "pathStart": { - "description": "Instances' URIs must start with this value for this schema to apply to them", - "type": "string", - "format": "uri" - } - }, - "definitions": { - "schemaArray": { - "type": "array", - "items": { - "$ref": "#" - } - }, - "linkDescription": { - "title": "Link Description Object", - "type": "object", - "required": [ - "href", - "rel" - ], + { "properties": { - "href": { - "description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing", - "type": "string" - }, - "rel": { - "description": "relation to the target resource of the link", - "type": "string" - }, - "title": { - "description": "a title for the link", - "type": "string" - }, - "targetSchema": { - "description": "JSON Schema describing the link target", - "$ref": "#" - }, - "mediaType": { - "description": "media type (as defined by RFC 2046) describing the link target", - "type": "string" - }, - "method": { - "description": "method for requesting the target of the link (e.g. for HTTP this might be \"GET\" or \"DELETE\")", - "type": "string" - }, - "encType": { - "description": "The media type in which to submit data along with the request", + "base": { "type": "string", - "default": "application/json" + "format": "uri-template" }, - "schema": { - "description": "Schema describing the data to submit along with the request", - "$ref": "#" + "links": { + "type": "array", + "items": { + "type": "object", + "required": [ + "rel", + "href" + ], + "properties": { + "anchor": { + "type": "string", + "format": "uri-template" + }, + "anchorPointer": { + "type": "string", + "anyOf": [ + { + "format": "json-pointer" + }, + { + "format": "relative-json-pointer" + } + ] + }, + "rel": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + ] + }, + "href": { + "type": "string", + "format": "uri-template" + }, + "hrefSchema": { + "$ref": "https://json-schema.org/draft/2019-09/hyper-schema", + "default": false + }, + "templatePointers": { + "type": "object", + "additionalProperties": { + "type": "string", + "anyOf": [ + { + "format": "json-pointer" + }, + { + "format": "relative-json-pointer" + } + ] + } + }, + "templateRequired": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "targetSchema": { + "$ref": "https://json-schema.org/draft/2019-09/hyper-schema", + "default": true + }, + "targetMediaType": { + "type": "string" + }, + "targetHints": {}, + "headerSchema": { + "$ref": "https://json-schema.org/draft/2019-09/hyper-schema", + "default": true + }, + "submissionMediaType": { + "type": "string", + "default": "application/json" + }, + "submissionSchema": { + "$ref": "https://json-schema.org/draft/2019-09/hyper-schema", + "default": true + }, + "$comment": { + "type": "string" + } + } + } } } - }, - "readOnly": { - "description": "If true, indicates that the value of this property is controlled by the server.", - "type": "boolean", - "default": false } - }, + ], "links": [ { "rel": "self", - "href": "{+id}" - }, - { - "rel": "full", - "href": "{+($ref)}" + "href": "{+%24id}" } ] }