[wp-trac] [WordPress Trac] #45635: Rest-API broken on trunk

WordPress Trac noreply at wordpress.org
Sun Dec 16 19:26:50 UTC 2018


#45635: Rest-API broken on trunk
-------------------------------+------------------------------
 Reporter:  hjanuschka         |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  REST API           |     Version:  5.0
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by hjanuschka):

 ok i bisect't it down (5.0.1 (good) to master), to exactly this commit.

 https://github.com/WordPress/WordPress/commit/a5b0312f1e263772cdcdf2c03b3fa25acaf7acf0


 in fact, commenting out the continue, where fields get removed, make my
 unittest's pass.



 what we test:
   - load all plugins (alot)
   - create some post via WP_RestRequest
   - make a WPRestRequest
   - validate response fields
   - after, above commit, our registered fields are not returned anymore.



 the thing is, we are not setting a schema definition on
 `register_rest_fields` - would be a huge refactor on our side (high
 potential for regressions).
 however ->
 https://developer.wordpress.org/reference/functions/register_rest_field/
 state's it is optional, and it does not say it will hide the field.


 i can understand, that relying on the schema is a good way, however i beg
 you to find an alternate solution, since it is kinda BC (resulting from a
 non-strict past) like:
   - adding filter before continue `wp_rest_response_fields($object,
 $fields)`
   - also include non-schema fields. (unsure at first sight howto do)


 let me know if there is acceptance for a change, and wich direction would
 be the best, and i am going to send a patch.

 right now - we have stopped updating to 5.x - and evaluating options.

 regards

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45635#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list