Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#51940 closed defect (bug) (fixed)

The schema for the taxonomy property of a term in the REST API should not include all taxonomies

Reported by: johnbillion's profile johnbillion Owned by: timothyblynjacobs's profile TimothyBlynJacobs
Milestone: 5.6.1 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch fixed-major
Focuses: Cc:

Description

When performing an OPTIONS request to a term endpoint of the REST API, for example /wp-json/wp/v2/tags or /wp-json/wp/v2/categories, the $.schema.properties.taxonomy.enum property in the schema contains a list of names of all taxonomies on the site (and to boot, not just those that are exposed via the REST API).

This is incorrect. The enum should contain only one value containing the name of the taxonomy associated with the route.

Change History (8)

This ticket was mentioned in PR #789 on WordPress/wordpress-develop by johnbillion.


4 years ago
#1

  • Keywords has-patch added; needs-patch removed

#2 @johnbillion
4 years ago

  • Milestone changed from Awaiting Review to 5.7

#3 @TimothyBlynJacobs
4 years ago

  • Owner set to TimothyBlynJacobs
  • Resolution set to fixed
  • Status changed from new to closed

In 49922:

REST API: Only include the controller's own taxonomy in it's schema.

Previously, all taxonomies were incorrectly exposed as possible values.

Props johnbillion.
Fixes #51940.

#4 @TimothyBlynJacobs
4 years ago

(and to boot, not just those that are exposed via the REST API)

Do you think we should backport this?

#6 @johnbillion
4 years ago

  • Keywords fixed-major added
  • Milestone changed from 5.7 to 5.6.1
  • Resolution fixed deleted
  • Status changed from closed to reopened

Yes this is a good candidate for backporting to 4.7.x.

This ticket was mentioned in Slack in #core by whyisjake. View the logs.


4 years ago

#8 @whyisjake
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 50047:

REST API: Only include the controller's own taxonomy in it's schema.

Previously, all taxonomies were incorrectly exposed as possible values.

This commit brings the changes from [49922] to the 5.6 branch.

Props johnbillion, TimothyBlynJacobs.

Fixes #51940.

Note: See TracTickets for help on using tickets.