class MyController extends GenericController { * /** Route of your new REST endpoint. */ * protected $rest_base = 'reports/my-thing'; * /** * * Provide JSON schema for the response item. * * @override WC_REST_Reports_Controller::get_item_schema() * */ * public function get_item_schema() { * $schema = array( * '$schema' => 'http://json-schema.org/draft-04/schema#', * 'title' => 'report_my_thing', * 'type' => 'object', * 'properties' => array( * 'product_id' => array( * 'type' => 'integer', * 'readonly' => true, * 'context' => array( 'view', 'edit' ), * 'description' => __( 'Product ID.', 'my_extension' ), * ), * ), * ); * // Add additional fields from `get_additional_fields` method and apply `woocommerce_rest_' . $schema['title'] . '_schema` filter. * return $this->add_additional_fields_schema( $schema ); * } * } *