[wp-trac] [WordPress Trac] #48266: REST API: logic used to filter nested _fields does not account for specifying multiple siblings
    WordPress Trac 
    noreply at wordpress.org
       
    Wed Oct  9 21:38:38 UTC 2019
    
    
  
#48266: REST API: logic used to filter nested _fields does not account for
specifying multiple siblings
--------------------------+--------------------------------------
 Reporter:  kadamwhite    |      Owner:  kadamwhite
     Type:  defect (bug)  |     Status:  assigned
 Priority:  normal        |  Milestone:  5.3
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:  has-unit-tests has-patch
  Focuses:  rest-api      |
--------------------------+--------------------------------------
 In #42094 we introduced logic to extend the `_fields` query parameter in
 order to specify that we wanted only one piece of a deeply nested object.
 While writing the dev note for this feature I discovered a logical error
 where our logic failed to account for the case where we specify two
 sibling properties of the same nested object.
 For example, given the response object
 {{{#!json
 {
         "id": 1,
         "meta": {
                 "key1": 1,
                 "key2": 2
         }
 }
 }}}
 and the query `/wp/v2/posts/1?_fields=meta.key1,meta.key2`, only meta.key2
 will be included.
 We can fix this by adjusting the manner in which
 `rest_filter_response_fields` sets the `$ref[ $next ]` value to account
 for an existing array at that location.
-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48266>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
    
    
More information about the wp-trac
mailing list