Make WordPress Core

Opened 16 months ago

Closed 5 months ago

#61911 closed defect (bug) (fixed)

Incorrect schema for global styles REST API endpoint

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
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 (17)

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


16 months ago
#1

  • Keywords has-patch added; needs-patch removed

@johnbillion commented on PR #7234:


16 months ago
#2

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

@narenin commented on PR #7234:


16 months ago
#3

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

@TimothyBlynJacobs commented on PR #7234:


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


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


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


15 months ago
#7

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

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


10 months ago

@audrasjb commented on PR #7234:


10 months ago
#11

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

@johnbillion commented on PR #7234:


10 months ago
#12

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

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


9 months ago
#14

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

@abcd95 commented on PR #8585:


9 months 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. 🙌🏻

@johnbillion commented on PR #7234:


5 months ago
#16

Closing this in favour of #8585 which is more comprehensive. Thanks!

#17 @johnbillion
5 months ago

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

In 60359:

Posts, Post Types: Correct the schema for the id property of the global styles REST API endpoint.

This property is an integer as it corresponds to a post ID.

Props narenin, TimothyBlynJacobs, audrasjb, johnbillion, mikinc860, abcd95

Fixes #61911

Note: See TracTickets for help on using tickets.