Merge pull request #21326 from woocommerce/fix/rest-api-settings-schema

[REST API] Updated Settings schema since now we allow batch update
This commit is contained in:
Claudiu Lodromanean 2018-09-11 13:16:36 -07:00 committed by GitHub
commit 92c5c4e54e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 43 additions and 0 deletions

View File

@ -66,4 +66,47 @@ class WC_REST_Settings_Controller extends WC_REST_Settings_V2_Controller {
return $response;
}
/**
* Get the groups schema, conforming to JSON Schema.
*
* @since 3.0.0
* @return array
*/
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'setting_group',
'type' => 'object',
'properties' => array(
'id' => array(
'description' => __( 'A unique identifier that can be used to link settings together.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'label' => array(
'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'description' => array(
'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'parent_id' => array(
'description' => __( 'ID of parent grouping.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'sub_groups' => array(
'description' => __( 'IDs for settings sub groups.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
),
);
return $this->add_additional_fields_schema( $schema );
}
}