[wp-trac] [WordPress Trac] #51757: REST API: Add const validation
WordPress Trac
noreply at wordpress.org
Mon Jan 25 14:47:24 UTC 2021
#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 has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by yakimun):
The `const` keyword acts in the same way as `enum` with a single value.
Our implementation of validation of `enum` was improved in #51911 to
handle values of different types correctly. These changes bring the new
function `rest_are_values_equal`, which correctly checks the equality of
two values.
I suggest implementing `const` validation using the
`rest_are_values_equal` because it will provide more consistent results.
The implementation of such a proposal is attached as a PR.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51757#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list