#50053 closed enhancement (fixed)
REST API: Support uuid json schema format
| Reported by: | TimothyBlynJacobs | Owned by: | TimothyBlynJacobs |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.5 |
| Component: | REST API | Version: | 4.7 |
| Severity: | normal | Keywords: | json-schema good-first-bug has-patch has-unit-tests |
| Cc: | Focuses: | rest-api |
Description
We should add support for format: "uuid" in rest_validate_value_from_schema. We can use the existing wp_is_uuid function for validation. And I'd imagine sanitize_text_field for sanitization.
At the moment, I think we can skip checking for a specific uuid version.
The list of formats is extensible, but uuid is also included as a format in the latest specs.
Change History (6)
This ticket was mentioned in PR #247 on WordPress/wordpress-develop by johnwatkins0.
6 years ago
#1
TimothyBJacobs commented on PR #247:
6 years ago
#4
Merged in ef05acd, [r47753](https://core.trac.wordpress.org/changeset/47753).
johnwatkins0 commented on PR #247:
6 years ago
#5
Thanks, @TimothyBJacobs !
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
https://core.trac.wordpress.org/ticket/50053
This adds support for the uuid format in WP REST JSON schema. As suggested in the ticket description, the format is validated with
wp_is_uuidand sanitized withsanitize_text_field.