Skip to content

REST API: remove search and page from the view config schema. - #12766

Open
oandregal wants to merge 1 commit into
WordPress:trunkfrom
oandregal:update/remove-page-and-search-from-schema
Open

REST API: remove search and page from the view config schema.#12766
oandregal wants to merge 1 commit into
WordPress:trunkfrom
oandregal:update/remove-page-and-search-from-schema

Conversation

@oandregal

Copy link
Copy Markdown
Member

Trac ticket https://core.trac.wordpress.org/ticket/65577
Backports WordPress/gutenberg#80832
Follow-up to #12391

search and page are managed via the URL, which is their only source of truth, so they should not be persisted as part of a view configuration.

Removes both properties from the shared ViewBase schema in WP_REST_View_Config_Controller, updates the WP_View_Config_Data docblock example that used search, and adds a test asserting neither property is declared by any view in the item schema.

`search` and `page` are managed via the URL, which is their only source of
truth, so they should not be persisted as part of a view configuration.

Removes both properties from the shared ViewBase schema in
`WP_REST_View_Config_Controller`, updates the `WP_View_Config_Data` docblock
example that used `search`, and adds a test asserting neither property is
declared by any view in the item schema.
Copilot AI review requested due to automatic review settings July 30, 2026 10:16
@oandregal oandregal self-assigned this Jul 30, 2026
@oandregal
oandregal requested a review from ntsekouras July 30, 2026 10:16
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props oandregal.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

The new schema test misses some view schemas present in the item schema (e.g., picker layouts), leaving a gap where search/page could be reintroduced without failing the test.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR updates the REST View Config schema to stop treating search and page as persisted view configuration properties, since they are URL-managed state and should not be stored in view configs.

Changes:

  • Removes search and page from the shared ViewBase schema in WP_REST_View_Config_Controller.
  • Updates the WP_View_Config_Data docblock example to avoid using search.
  • Adds a PHPUnit test asserting search and page are not declared by view schemas in the item schema.
File summaries
File Description
tests/phpunit/tests/rest-api/rest-view-config-controller.php Adds a schema assertion test intended to ensure URL-managed properties are not part of any view schema.
src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php Removes search/page from the shared view schema and documents why.
src/wp-includes/class-wp-view-config-data.php Updates documentation examples to avoid using removed schema properties.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +399 to +406
$views = array(
'default_view' => $schema['properties']['default_view']['properties'],
'view_list item view' => $schema['properties']['view_list']['items']['properties']['view']['properties'],
'default_layouts.table' => $schema['properties']['default_layouts']['properties']['table']['properties'],
'default_layouts.grid' => $schema['properties']['default_layouts']['properties']['grid']['properties'],
'default_layouts.list' => $schema['properties']['default_layouts']['properties']['list']['properties'],
'default_layouts.activity' => $schema['properties']['default_layouts']['properties']['activity']['properties'],
);
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@ntsekouras ntsekouras left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backported changes look good, thanks! I'm approving now, since the GB PR doesn't expect any other PHP changes is almost ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants