Plugin Directory: Validate the required parameter for the bulk stats update endpoint#579
Plugin Directory: Validate the required parameter for the bulk stats update endpoint#579
Conversation
…update endpoint. The endpoint didn't define any argument requirements, so requests missing the expected data would reach the callback and trigger a PHP warning when iterating over a null value. Adds a schema definition that validates the shape and types of the incoming data at the REST API layer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Adds REST API request-argument validation for the internal plugin stats bulk update endpoint (/plugins/v1/update-stats) so that requests missing the required plugins payload are rejected by the REST layer before the callback executes.
Changes:
- Defines
argsfor the route and markspluginsasrequired. - Adds a basic JSON-schema-style shape/type definition for each plugin’s stats object (e.g.,
active_installs,usage, support thread counts).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@dd32 Could I ask for a sanity check for these changes? It doesn't look like the two places calling this endpoint should be bothered by getting an error returned when This fixes: |
… and capability fixes Agent-Logs-Url: https://github.com/obenland/wordpress.org/sessions/96f2f701-fe73-444a-829b-7bb3a541fbea Co-authored-by: obenland <1398304+obenland@users.noreply.github.com>
Summary
/plugins/v1/update-statsendpoint didn't define any argument requirements, so requests missing thepluginsparameter would reach the callback and trigger a PHP warning when iterating over a null value.Test plan
pluginsobject still work as expectedpluginsreturn a REST API validation error instead of triggering a PHP warning🤖 Generated with Claude Code