Skip to content

Commit

Permalink
[REST API] Fixed order notes schema
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Sep 11, 2018
1 parent 1411567 commit 45c542a
Showing 1 changed file with 55 additions and 13 deletions.
68 changes: 55 additions & 13 deletions includes/api/class-wc-rest-order-notes-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,61 @@ public function create_item( $request ) {
* @return array
*/
public function get_item_schema() {
$schema = parent::get_item_schema();
$schema['properties']['author'] = array(
'description' => __( 'Order note author.', 'woocommerce' ),
'type' => 'string',
'readonly' => true,
'context' => array( 'view', 'edit' ),
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'order_note',
'type' => 'object',
'properties' => array(
'id' => array(
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'author' => array(
'description' => __( 'Order note author.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_created' => array(
'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_created' => array(
'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_created_gmt' => array(
'description' => __( 'The date the order note was created, as GMT.', 'woocommerce' ),
'type' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'note' => array(
'description' => __( 'Order note content.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'customer_note' => array(
'description' => __( 'If true, the note will be shown to customers and they will be notified. If false, the note will be for admin reference only.', 'woocommerce' ),
'type' => 'boolean',
'default' => false,
'context' => array( 'view', 'edit' ),
),
'added_by_user' => array(
'description' => __( 'If true, this note will be attributed to the current user. If false, the note will be attributed to the system.', 'woocommerce' ),
'type' => 'boolean',
'default' => false,
'context' => array( 'edit' ),
),
),
);
$schema['properties']['added_by_user'] = array(
'description' => __( 'If true, this note will be attributed to the current user. If false, the note will be attributed to the system.', 'woocommerce' ),
'type' => 'boolean',
'default' => false,
'context' => array( 'edit' ),
);
return $schema;

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

0 comments on commit 45c542a

Please sign in to comment.