From 63390c181de4046f36898b5e6c9e4dc4f157f3c2 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 16 Oct 2018 13:19:41 -0300 Subject: [PATCH] [REST API] Fixed schema for product's downloads Download ID are generated with wp_generate_uuid4() for while now. Also we allow users to manipulate it. --- .../api/class-wc-rest-product-variations-controller.php | 3 +-- includes/api/class-wc-rest-products-controller.php | 3 +-- includes/api/v1/class-wc-rest-products-controller.php | 6 ++---- .../v2/class-wc-rest-product-variations-v2-controller.php | 3 +-- includes/api/v2/class-wc-rest-products-v2-controller.php | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/includes/api/class-wc-rest-product-variations-controller.php b/includes/api/class-wc-rest-product-variations-controller.php index b393a567b47..8cb3b101239 100644 --- a/includes/api/class-wc-rest-product-variations-controller.php +++ b/includes/api/class-wc-rest-product-variations-controller.php @@ -514,10 +514,9 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File MD5 hash.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), - 'readonly' => true, ), 'name' => array( 'description' => __( 'File name.', 'woocommerce' ), diff --git a/includes/api/class-wc-rest-products-controller.php b/includes/api/class-wc-rest-products-controller.php index 1497fcae3f9..6c081c6cf18 100644 --- a/includes/api/class-wc-rest-products-controller.php +++ b/includes/api/class-wc-rest-products-controller.php @@ -862,10 +862,9 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File MD5 hash.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), - 'readonly' => true, ), 'name' => array( 'description' => __( 'File name.', 'woocommerce' ), diff --git a/includes/api/v1/class-wc-rest-products-controller.php b/includes/api/v1/class-wc-rest-products-controller.php index 9d893f039c8..7695345d386 100644 --- a/includes/api/v1/class-wc-rest-products-controller.php +++ b/includes/api/v1/class-wc-rest-products-controller.php @@ -1882,10 +1882,9 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File MD5 hash.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), - 'readonly' => true, ), 'name' => array( 'description' => __( 'File name.', 'woocommerce' ), @@ -2360,10 +2359,9 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File MD5 hash.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), - 'readonly' => true, ), 'name' => array( 'description' => __( 'File name.', 'woocommerce' ), diff --git a/includes/api/v2/class-wc-rest-product-variations-v2-controller.php b/includes/api/v2/class-wc-rest-product-variations-v2-controller.php index 6cb3350ab1d..26883d35a66 100644 --- a/includes/api/v2/class-wc-rest-product-variations-v2-controller.php +++ b/includes/api/v2/class-wc-rest-product-variations-v2-controller.php @@ -762,10 +762,9 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File MD5 hash.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), - 'readonly' => true, ), 'name' => array( 'description' => __( 'File name.', 'woocommerce' ), diff --git a/includes/api/v2/class-wc-rest-products-v2-controller.php b/includes/api/v2/class-wc-rest-products-v2-controller.php index 1ed1c1e0acc..592dacfd8c2 100644 --- a/includes/api/v2/class-wc-rest-products-v2-controller.php +++ b/includes/api/v2/class-wc-rest-products-v2-controller.php @@ -1606,10 +1606,9 @@ class WC_REST_Products_V2_Controller extends WC_REST_Legacy_Products_Controller 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File MD5 hash.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), - 'readonly' => true, ), 'name' => array( 'description' => __( 'File name.', 'woocommerce' ),