[wp-trac] [WordPress Trac] #51757: REST API: Add const validation

WordPress Trac noreply at wordpress.org
Thu Nov 12 19:10:06 UTC 2020


#51757: REST API: Add const validation
-----------------------------------+------------------------------
 Reporter:  ajlende                |       Owner:  (none)
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  REST API               |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch json-schema  |     Focuses:
-----------------------------------+------------------------------

Comment (by ajlende):

 I didn't realize that it was a v6 thing. In my opinion, we're already not
 strictly spec compliant for v4—there are gotchas like assuming the top-
 level array is `properties`, assuming `'type' => 'object'` at the top-
 level, and using the `required` boolean for individual properties—so I
 don't see any harm in adding a keyword which will eventually be spec
 compliant when we already have these quirks.

 However, it would be nice if we did implement the `$schema` keyword and
 require a value of `http://json-schema.org/draft-04/schema#` for a spec-
 compliant version of v4 and `http://json-schema.org/draft-06/schema#` for
 things with v6 features like `const`.

 I trust your decision making on whether or not to add it, and I can still
 just use the `enum` keyword, so this is in no way a blocker for anything.

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


More information about the wp-trac mailing list