WC_REST_Data_Countries_Controller::get_item_schema
Get the location schema, conforming to JSON Schema.
Method of the class: WC_REST_Data_Countries_Controller{}
No Hooks.
Returns
Array.
Usage
$WC_REST_Data_Countries_Controller = new WC_REST_Data_Countries_Controller(); $WC_REST_Data_Countries_Controller->get_item_schema();
Changelog
| Since 3.5.0 | Introduced. |
WC_REST_Data_Countries_Controller::get_item_schema() WC REST Data Countries Controller::get item schema code WC 10.4.3
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'data_countries',
'type' => 'object',
'properties' => array(
'code' => array(
'type' => 'string',
'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ),
'context' => array( 'view' ),
'readonly' => true,
),
'name' => array(
'type' => 'string',
'description' => __( 'Full name of country.', 'woocommerce' ),
'context' => array( 'view' ),
'readonly' => true,
),
'states' => array(
'type' => 'array',
'description' => __( 'List of states in this country.', 'woocommerce' ),
'context' => array( 'view' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'context' => array( 'view' ),
'readonly' => true,
'properties' => array(
'code' => array(
'type' => 'string',
'description' => __( 'State code.', 'woocommerce' ),
'context' => array( 'view' ),
'readonly' => true,
),
'name' => array(
'type' => 'string',
'description' => __( 'Full name of state.', 'woocommerce' ),
'context' => array( 'view' ),
'readonly' => true,
),
),
),
),
),
);
return $this->add_additional_fields_schema( $schema );
}