[wp-trac] [WordPress Trac] #49960: REST API: Support sanitize callbacks for nested properties

WordPress Trac noreply at wordpress.org
Sat Apr 25 23:50:43 UTC 2020


#49960: REST API: Support sanitize callbacks for nested properties
------------------------------------------+------------------------------
 Reporter:  ocean90                       |       Owner:  (none)
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  REST API                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by TimothyBlynJacobs):

 This would definitely be helpful. I'm not sure what the best way to go
 about it is.

 We have `rest_validate_request_from_schema`, but that doesn't have any
 knowledge of the idea of `sanitize_callback` or `validate_callback` and
 I'd be hesitant to add that to what is a generic JSON schema
 validator/sanitizer.

 Perhaps it could live in `rest_validate_request_arg`? Though for similar
 reasons as mentioned in #48818, it'd be much simpler to add it to
 `rest_validate_value_from_schema` since it handles schema traversing.
 Maybe we need a general purpose schema traversing function?

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


More information about the wp-trac mailing list