WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 8 months 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 Owned by: 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.


10 months ago

  • Keywords has-patch added; needs-patch removed

#2 @johnbillion
10 months ago

  • Milestone changed from Awaiting Review to 5.7

#3 @TimothyBlynJacobs
9 months 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
9 months ago

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

Do you think we should backport this?

#6 @johnbillion
9 months 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.


8 months ago

#8 @whyisjake
8 months 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.