WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#38617 closed enhancement (fixed)

Remove unneeded validation callbacks now we have a default

Reported by: joehoyle Owned by: joehoyle
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: Cc:

Description

This is a cleanup of all the params to remove the use of rest_validate_request_arg where it's not needed, also some places were doing a custom sanitize callback on enums, which is not needed now either.

Attachments (3)

38617.diff (18.3 KB) - added by joehoyle 4 years ago.
38617.2.diff (65.3 KB) - added by joehoyle 4 years ago.
38617.3.diff (43.4 KB) - added by jnylen0 4 years ago.

Download all attachments as: .zip

Change History (10)

@joehoyle
4 years ago

#1 @joehoyle
4 years ago

  • Owner set to joehoyle
  • Status changed from new to assigned

@joehoyle
4 years ago

#2 @joehoyle
4 years ago

Added a new patch with tests to cover all the failing cases on the validation. Phew!

This ticket was mentioned in Slack in #core-restapi by joehoyle. View the logs.


4 years ago

#4 @joehoyle
4 years ago

I also discovered a small issue that I found while writing all the tests - we are accidentally added $taxonomy_exclude as a Schema item, rather than a collection param. This is just in the registration stuff, I added more tests for that specifically fixed it up.

@jnylen0
4 years ago

#5 @jnylen0
4 years ago

There was some whitespace weirdness in 38617.2.diff including a bunch of unintended changes in the test suite. Should be cleaned up in 38617.3.diff. Definitely take a look and make sure I didn't miss anything, but I verified as follows:

  • Committed 38617.2.diff to a branch in my local git repository
  • Reversed that patch via git show | git apply -R and then applied 38617.3.diff
  • git diff -w returns nothing
Last edited 4 years ago by jnylen0 (previous) (diff)

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


4 years ago

#7 @rachelbaker
4 years ago

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

In 39105:

REST API: Clean-up our validation callbacks and add missing array items properties in our endpoint schemas.

Props joehoyle, jnylen0.
Fixes #38617.

Note: See TracTickets for help on using tickets.