#65355 closed enhancement (fixed)
Abilities API: Unify schema conventions across core abilities
| Reported by: | gziolo | Owned by: | gziolo |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Abilities API | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests has-dev-note |
| Cc: | Focuses: |
Description
The three core abilities shipped in 6.9.0 (core/get-site-info, core/get-user-info, core/get-environment-info) have drifted in small but visible ways. This ticket proposes a quality pass so they share a single blueprint.
Proposed Changes
- Every output property should declare both
titleanddescription, reusing existing WP Admin translations where possible. core/get-environment-infoshould gain the optionalfieldsinput parameter already supported by the other two.core/get-user-infoshould be exposed via REST (show_in_rest => true) so clients can discover it under/wp-json/wp-abilities/v1/abilities.- Property titles should be normalized to Title Case.
Each change should be accompanied by unit tests so the unified contract is enforced going forward.
Change History (7)
This ticket was mentioned in PR #11984 on WordPress/wordpress-develop by @gziolo.
3 months ago
#1
- Keywords has-patch has-unit-tests added
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
## Summary
The three core abilities shipped in 6.9.0 (
core/get-site-info,core/get-user-info,core/get-environment-info) drifted in small but visible ways. This PR aligns them on a shared blueprint so they're predictable to consume from REST clients and easier to extend.titleanddescription, reusing existing WP Admin translations where possible.core/get-environment-infoaccepts the optionalfieldsinput parameter already supported by the other two, with anenumof valid keys.core/get-user-infois exposed via REST (show_in_rest => true) so clients can discover and invoke it under/wp-json/wp-abilities/v1/abilities.db_server_infois relabeledDatabase Server Infosince\$wpdb->db_server_info()returns vendor+version, not just a version.enumand the outputproperties, so any future field addition forces a test update.## Test plan
npm run test:php -- --filter=Tests_Abilities_API_WpRegisterCoreAbilitiesis greencore/get-user-infois listed at/wp-json/wp-abilities/v1/abilitiesfor an authenticated usercore/get-environment-infoaccepts{"fields":["php_version"]}and returns only that keyability_invalid_inputerrornpm run env:composer -- lint -- src/wp-includes/abilities.phpreports no violationsnpm run typecheck:phppasses🤖 Generated with Claude Code