REST API: Support for objects in schema validation and sanitization.
When registering routes developers can now define their complex objects in the schema and benefit from the automatic validation and sanitization in the REST API. This also paves the way for support for complex object registration via register_meta and register_setting. See #38583. Props TimothyBlynJacobs5. Built from https://develop.svn.wordpress.org/trunk@41727 git-svn-id: http://core.svn.wordpress.org/trunk@41561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -391,6 +391,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'arg_options' => array(
|
||||
'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
|
||||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
@@ -413,6 +414,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'arg_options' => array(
|
||||
'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
|
||||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
|
||||
@@ -1200,6 +1200,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'arg_options' => array(
|
||||
'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
|
||||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
|
||||
@@ -1846,6 +1846,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'arg_options' => array(
|
||||
'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
|
||||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
@@ -1870,6 +1871,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'arg_options' => array(
|
||||
'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
|
||||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
@@ -1908,6 +1910,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'arg_options' => array(
|
||||
'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database()
|
||||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
|
||||
Reference in New Issue
Block a user