[wp-trac] [WordPress Trac] #56221: Add download URL to plugins REST create (install) endpoint
WordPress Trac
noreply at wordpress.org
Sat Oct 22 06:33:51 UTC 2022
#56221: Add download URL to plugins REST create (install) endpoint
-------------------------------------+-------------------------------------
Reporter: brianhenryie | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 5.5
Severity: minor | Resolution:
Keywords: needs-testing has-unit- | Focuses: administration, rest-
tests has-patch dev-feedback | api
-------------------------------------+-------------------------------------
Changes (by brianhenryie):
* keywords: has-patch has-unit-tests => needs-testing has-unit-tests has-
patch dev-feedback
* severity: normal => minor
Comment:
Tests are passing, so it's probably good to merge!
But...
1. There seems to be no way to require one-of-two parameters. See
[WP_REST_Request::has_valid_params()](https://github.com/WordPress
/wordpress-develop/blob/f8daa24858d56ad1d2eb6a450ee4de543c638954/src/wp-
includes/rest-api/class-wp-rest-request.php#L880) where `$arg['required']`
is a `bool`.
I looked at using `validate_callback` but it is invoked per parameter,
i.e. if both are missing, it is never called, so it can't impose a "one of
these must be present" requirement.
The test case I rough-worked (not committed) did fail as it should,
anyway.
2. I couldn't find a .tar plugin on .org to validate the non-zip scenario.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56221#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list