Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#52375 closed enhancement (fixed)

Extract the validation of specific data types from rest_validate_value_from_schema() into separate functions

Reported by: yakimun's profile yakimun Owned by: timothyblynjacobs's profile TimothyBlynJacobs
Milestone: 5.7 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch
Focuses: Cc:

Description

The current implementation of the rest_validate_value_from_schema function contains a lot of code and is difficult to read. Most of the code of this function is related to the validation of specific data types.

We can extract the type validation logic into separate functions to improve readability and maintainability.

Change History (4)

This ticket was mentioned in PR #924 on WordPress/wordpress-develop by yakimun.


3 years ago
#1

  • Keywords has-patch added

Specific types validation logic extracted from the rest_validate_value_from_schema function into separate functions.

Trac ticket: https://core.trac.wordpress.org/ticket/52375

#2 @TimothyBlynJacobs
3 years ago

  • Milestone changed from Awaiting Review to 5.7
  • Version set to 4.7

Thanks for the patch, this is a great improvement @yakimun!

#3 @TimothyBlynJacobs
3 years ago

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

In 50060:

REST API: Refactor rest_validate_value_from_schema into separate validation functions per-type.

Props yakimun.
Fixes #52375.

Note: See TracTickets for help on using tickets.