Make WordPress Core


Ignore:
Timestamp:
10/20/2020 06:22:39 PM (4 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Add support for the oneOf and anyOf keywords.

This allows for REST API routes to define more complex validation requirements as JSON Schema instead of procedural validation.

The error code returned from rest_validate_value_from_schema for invalid parameter types has been changed from the generic rest_invalid_param to the more specific rest_invalid_type.

Props yakimun, johnbillion, TimothyBlynJacobs.
Fixes #51025.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-term-meta-fields.php

    r48937 r49246  
    640640
    641641        $response = rest_get_server()->dispatch( $request );
    642         $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
     642        $this->assertErrorResponse( 'rest_invalid_type', $response, 400 );
    643643    }
    644644
     
    665665
    666666        $response = rest_get_server()->dispatch( $request );
    667         $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
     667        $this->assertErrorResponse( 'rest_invalid_type', $response, 400 );
    668668    }
    669669
Note: See TracChangeset for help on using the changeset viewer.