WC_REST_Data_Controller::get_item_schema()publicWC 3.5.0

Get the data index schema, conforming to JSON Schema.

Method of the class: WC_REST_Data_Controller{}

No Hooks.

Return

Array.

Usage

$WC_REST_Data_Controller = new WC_REST_Data_Controller();
$WC_REST_Data_Controller->get_item_schema();

Changelog

Since 3.5.0 Introduced.

WC_REST_Data_Controller::get_item_schema() code WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'data_index',
		'type'       => 'object',
		'properties' => array(
			'slug'        => array(
				'description' => __( 'Data resource ID.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'description' => array(
				'description' => __( 'Data resource description.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
		),
	);

	return $this->add_additional_fields_schema( $schema );
}