[wp-trac] [WordPress Trac] #50509: Json schema validation

WordPress Trac noreply at wordpress.org
Mon Jun 29 15:58:42 UTC 2020


#50509: Json schema validation
--------------------------------------+------------------------------
 Reporter:  sorenbronsted             |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  REST API                  |     Version:  4.7
 Severity:  normal                    |  Resolution:
 Keywords:  dev-feedback 2nd-opinion  |     Focuses:  rest-api
--------------------------------------+------------------------------
Changes (by TimothyBlynJacobs):

 * version:   => 4.7


Comment:

 Thanks for the ticket @sorenbronsted!

 Did you have any libraries in mind?

 Some things we need to consider:

 1. Sanitization. Our schema implementation also supports sanitizing
 values. Are there any other json schema libraries that do this?
 2. Translation. The libraries I've seen aren't very amenable to
 translating the error messages. They also often concatenate parts of
 different English strings together, which doesn't work for all languages.
 3. Type conversion. We need to make sure things like are boolean checks
 behave the same way. Additionally we support csv syntax for arrays. This
 would need to be checked for all types.
 4. v3 required syntax.
 5. Our schema validators don't work on an entire schema for top level
 requests properties. So we'd need to transform those values into something
 the validator could work with.
 6. Dependency size. Our schema validator is comparably small to the other
 PHP schema validators I've seen. We don't want to bring on a large
 dependency.

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


More information about the wp-trac mailing list