Skip to content

Commit

Permalink
Excluding search, include and exclude from the collection query params
Browse files Browse the repository at this point in the history
Excluding order and order by from the collection query params

Comment
  • Loading branch information
ramonjd committed Jan 3, 2024
1 parent f80d6b2 commit 1120502
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,22 @@ public function get_item_schema() {

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

/**
* Retrieves the query params for collections.
* Removes params that are not supported by global styles revisions.
*
* @since 6.5.0
*
* @return array Collection parameters.
*/
public function get_collection_params() {
$query_params = parent::get_collection_params();
unset( $query_params['exclude'] );
unset( $query_params['include'] );
unset( $query_params['search'] );
unset( $query_params['order'] );
unset( $query_params['orderby'] );
return $query_params;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ public function test_get_items_out_of_bounds_page_should_not_error_if_offset() {
* @doesNotPerformAssertions
*/
public function test_context_param() {
// Controller does not implement test_context_param().
// Controller does not implement get_context_param().
}

/**
Expand Down
48 changes: 0 additions & 48 deletions tests/qunit/fixtures/wp-api-generated.js
Original file line number Diff line number Diff line change
Expand Up @@ -10035,58 +10035,10 @@ mockedApiResponse.Schema = {
"maximum": 100,
"required": false
},
"search": {
"description": "Limit results to those matching a string.",
"type": "string",
"required": false
},
"exclude": {
"description": "Ensure result set excludes specific IDs.",
"type": "array",
"items": {
"type": "integer"
},
"default": [],
"required": false
},
"include": {
"description": "Limit result set to specific IDs.",
"type": "array",
"items": {
"type": "integer"
},
"default": [],
"required": false
},
"offset": {
"description": "Offset the result set by a specific number of items.",
"type": "integer",
"required": false
},
"order": {
"description": "Order sort attribute ascending or descending.",
"type": "string",
"default": "desc",
"enum": [
"asc",
"desc"
],
"required": false
},
"orderby": {
"description": "Sort collection by object attribute.",
"type": "string",
"default": "date",
"enum": [
"date",
"id",
"include",
"relevance",
"slug",
"include_slugs",
"title"
],
"required": false
}
}
}
Expand Down

0 comments on commit 1120502

Please sign in to comment.