Make WordPress Core

Opened 4 months ago

Last modified 7 weeks ago

#61911 new defect (bug)

Incorrect schema for global styles REST API endpoint

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: 6.8 Priority: normal
Severity: normal Version: 5.9
Component: Posts, Post Types Keywords: has-patch
Focuses: rest-api Cc:

Description

The schema for the wp/v2/global-styles/{id} REST API endpoint declares the id property as a string, but it is in fact an integer containing the post ID for the global style.

Change History (9)

This ticket was mentioned in PR #7234 on WordPress/wordpress-develop by @narenin.


4 months ago
#1

  • Keywords has-patch added; needs-patch removed

@johnbillion commented on PR #7234:


4 months ago
#2

@narenin Thanks for the PR. int isn't a valid type in JSON schema.

@narenin commented on PR #7234:


3 months ago
#3

@johnbillion Thanks for the review, I have updated the same to integer, please check.

@TimothyBlynJacobs commented on PR #7234:


3 months ago
#4

This is slightly weird because the value does have a sanitize_callback registered for it which calls urldecode, which seems like an indication that the value is supposed to be a string. Are we sure this is supposed to be an integer? If so, we should probably also be removing the sanitize_callback.

narendraie commented on PR #7234:


3 months ago
#5

Thanks @johnbillion @TimothyBJacobs for your feedback's, I have implemented the same, could you please take a look.

@narenin commented on PR #7234:


3 months ago
#6

Thanks @johnbillion @TimothyBJacobs for your feedback's, I have implemented the same, could you please take a look.

narendraie commented on PR #7234:


3 months ago
#7

Thanks @johnbillion @TimothyBJacobs for your feedback's, I have implemented the same, could you please take a look.

#8 @johnbillion
2 months ago

  • Keywords good-first-bug removed
  • Milestone changed from 6.7 to 6.8

This is close but there are some failing tests in the associated PR that need to be investigated.

#9 @mikinc860
7 weeks ago

@johnbillion The regular expression for the id parameter can be simplified. The pattern (?P<id>[\/\d+]+) implies that the id can contain slashes, which is unusual for an integer ID. It would be more appropriate to use (?P<id>\d+) to match only digits.

Note: See TracTickets for help on using tickets.