#38398 closed defect (bug) (fixed)
Write proper doc blocks for the REST API endpoints
Reported by: | flixos90 | Owned by: | |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | good-first-bug has-patch |
Focuses: | docs | Cc: |
Description
Many aspects of the new API endpoints and meta fields classes do not have proper documentation following the WordPress standards yet. We should make sure they do (file headers, third-person singular verbs, access/since annotations, parameter and return value descriptions etc).
I will gladly take care of some of it, but wouldn't mind help. Maybe we can get a small group together and assign a set of related classes (or maybe even similar methods in different classes) to everyone, in order to make this an easy task. :)
Attachments (10)
Change History (41)
@
8 years ago
Docs: Improve documentation for WP_REST_Users_Controller
, WP_REST_Terms_Controller
, WP_REST_Taxonomies_Controller
, WP_REST_Settings_Controller
.
#2
@
8 years ago
- Keywords needs-docs added; needs-patch removed
- Milestone changed from Awaiting Review to 4.7
#3
@
8 years ago
@johnbillion There are several WordPress Coding Standards issue in the REST API files. I'd like to address them, would this be the right ticket for it? If so, it needs to be edited as such. Otherwise, I can create a new ticket about "REST API Files To Follow WP Coding Standards".
To help you better understand it better, in class-wp-rest-request.php
there is a Yoda conditions issue... Addressing it and posting it here under "Write proper doc blocks for the REST API endpoints" feels a bit weird per se.
Looking forward!
@
8 years ago
FIX: WP Doc & Coding standards in class-wp-rest-request.php
, class-wp-rest-response.php
, and class-wp-rest-server.php
. Addresses missing foreach() endings, space after foreach, yoda conditions, replaced esle if
with elseif
.
@
8 years ago
FIX: WP Doc & Coding standards like missing end foreach() comments, periods after inline comments, file header DocBlocks, class var DocBlocks.
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
This ticket was mentioned in Slack in #docs by soean. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-restapi by soean. View the logs.
8 years ago
#9
@
8 years ago
Thanks for all the great work and patches @Soean and @mrahmadawais!
I did an initial review (38398.9.patch) and made the following adjustments:
- the third-person singular form is now applied to all method descriptions
- the term
boolean
(for method and hook parameters) is now replaced withbool
- the class headers are more meaningful and similar to other Core classes
Other small issues I encountered which further review should happen on (I adjusted several instances, but probably not everything yet):
- there are still several parameter descriptions missing
- sometimes parameters are indented wrong
- words like "comment", "attachment" and such should probably not be capitalized
Another notice (not docs-related): Some implementations of abstract methods return WP_Rest_Response
objects while others return arrays. This will not cause bugs at this point (since they are parsed afterwards anyway), but we might wanna align them to all return proper response objects. A similar issue with permission checks, most of them return WP_Error
objects on failure, but some of them return either WP_Error
or boolean false
- maybe we can also provide proper error objects for those that only return false
.
#13
@
8 years ago
- Keywords needs-docs removed
38398.diff is an updated version of 38398.9.patch following the last three commits.
#30
@
8 years ago
- Resolution set to fixed
- Status changed from new to closed
I think that covers all of the docs fixes in the latest patch 38398.diff and 38398.9.patch.
Closing this out in favor of new tickets for docs fixes in specific files.
Docs: Improve documentation for
WP_REST_Users_Controller
.