Skip to content

Commit

Permalink
Improve naming for URL Metric schema properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ShyamGadde committed Nov 28, 2024
1 parent 63758ef commit 08f8f8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions plugins/optimization-detective/class-od-url-metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* }
* @phpstan-type Data array{
* uuid: non-empty-string,
* eTag?: string,
* etag?: string,
* url: non-empty-string,
* timestamp: float,
* viewport: ViewportRect,
Expand Down Expand Up @@ -156,7 +156,7 @@ public function set_group( OD_URL_Metric_Group $group ): void {
* Gets JSON schema for URL Metric.
*
* @since 0.1.0
* @since n.e.x.t Added the 'eTag' property to the schema.
* @since n.e.x.t Added the 'etag' property to the schema.
*
* @todo Cache the return value?
*
Expand Down Expand Up @@ -210,7 +210,7 @@ public static function get_json_schema(): array {
'required' => true,
'readonly' => true, // Omit from REST API.
),
'eTag' => array(
'etag' => array(
'description' => __( 'The ETag for the URL Metric.', 'optimization-detective' ),
'type' => 'string',
'required' => false, // To be made required in a future release.
Expand Down Expand Up @@ -434,7 +434,7 @@ public function get_uuid(): string {
*/
public function get_etag(): ?string {
// Since the ETag is optional for now, return null for old URL Metrics that do not have one.
return $this->data['eTag'] ?? null;
return $this->data['etag'] ?? null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion plugins/optimization-detective/storage/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function od_handle_rest_request( WP_REST_Request $request ) {
// Now supply the readonly args which were omitted from the REST API params due to being `readonly`.
'timestamp' => microtime( true ),
'uuid' => wp_generate_uuid4(),
'eTag' => $request->get_param( 'eTag' ),
'etag' => $request->get_param( 'eTag' ),
)
)
);
Expand Down

0 comments on commit 08f8f8a

Please sign in to comment.