Skip to content

REST API schema docs should be updated with new formats introduced in WP 5.9 #2021

@jonwaldstein

Description

@jonwaldstein

Issue Description

As of WordPress 5.9 there are new options for the format param including text and textarea.

These are important for string types because without specifying a format, strings do not get sanitized properly.

Ref: https://github.com/WordPress/WordPress/blob/86b7fc84bdff5a9db05a120bba7858d5f4d32364/wp-includes/rest-api.php#L2763

URL of the Page with the Issue

https://developer.wordpress.org/rest-api/extending-the-rest-api/schema

Section of Page with the issue

Why is this a problem?

When utilizing the REST API with json schema, it is really handy to know the format options that help with sanitization, particularly for string fields.

Suggested Fix

Changelog

https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#changelog

We should add 5.9

WordPress 5.9

  • Support the text-field and textarea-field formats.

In this section

Image

we should add:

  • text-field a text field
  • textarea-field a textarea field

It would also be good to mention how by adding these formats it will also take care of sanitization.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions