Make WordPress Core

Opened 8 months ago

Last modified 5 weeks ago

#61911 new defect (bug)

Incorrect schema for global styles REST API endpoint

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: 6.9 Priority: normal
Severity: normal Version: 5.9
Component: Posts, Post Types Keywords: has-patch has-unit-tests
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 (15)

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


8 months ago
#1

  • Keywords has-patch added; needs-patch removed

@johnbillion commented on PR #7234:


8 months ago
#2

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

@narenin commented on PR #7234:


8 months ago
#3

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

@TimothyBlynJacobs commented on PR #7234:


7 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:


7 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:


7 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:


7 months ago
#7

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

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

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


3 months ago

@audrasjb commented on PR #7234:


3 months ago
#11

@johnbillion @TimothyBJacobs are you available to review the edited PR? Thanks!

@johnbillion commented on PR #7234:


2 months ago
#12

@narenin Want to take a look at these failing unit tests?

#13 @johnbillion
8 weeks ago

  • Keywords needs-unit-tests added
  • Milestone changed from 6.8 to 6.9

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


5 weeks ago
#14

  • Keywords has-unit-tests added; needs-unit-tests removed

@abcd95 commented on PR #8585:


5 weeks ago
#15

Hi @johnbillion. I have added the unit tests and updated the existing test files. Now, all the tests are passing. Let me know if the changes look good to you. 🙌🏻

Note: See TracTickets for help on using tickets.