[wp-trac] [WordPress Trac] #44949: Add support for JSON Schema string pattern to REST API

WordPress Trac noreply at wordpress.org
Sat Sep 22 03:35:53 UTC 2018


#44949: Add support for JSON Schema string pattern to REST API
----------------------------------------+------------------------------
 Reporter:  jason_the_adams             |       Owner:  (none)
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  REST API                    |     Version:  trunk
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------------------

Comment (by jason_the_adams):

 > My understanding is that the `[a-zA-Z]` part is the actual regex and for
 convenience purposes you can pass flags to the regex by using the
 delimiter syntax to instantiate the `RegExp`.
 Sorry, I'm confused by this sentence. It sounds like you're saying the
 pattern would include the delimiter and flags, but I know that's not what
 you're saying because you said I should change the current patch to not do
 that. So... I'm not sure what you're saying, then. 😄

 >Interestingly, looking at the PHP validators, they all use the `u` flag.
 Presumably to reject non UTF-8 characters. I believe PHP requires JSON to
 be in UTF-8. To be consistent, we might also want to add this flag so it
 rejects non UTF-8 strings since request data might not come from JSON.
 Can't say I've played around with that flag (just did to understand it).
 Makes sense and seems like it's good to have when one wants it.

 Adding another patch to reflect what we've discussed so far.

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


More information about the wp-trac mailing list