iron-bound-designs / wp-rest-api-schema-validator

Validate WP REST API requests using a complete JSON Schema validator.
https://timothybjacobs.com/2017/05/17/json-schema-and-the-wp-rest-api/
MIT License
12 stars 2 forks source link

WordPress 5.5+ Support for register_rest_route permission_callback #2

Closed thefrosty closed 3 years ago

thefrosty commented 3 years ago

Register REST Route requires the permission_callback.

register_rest_route($namespace = 'wp/v2', $route = '/schemas/(?P<title>\\S+)', $args = ['args' => ['method' => [...], 'expand' => [...]], 'methods' => 'GET', 'callback' => [0 => class IronBound\WP_REST_API\SchemaValidator\Middleware { ... }, 1 => 'get_schema_endpoint']], $override = *uninitialized*) /usr/local/wordpress/vendor/ironbound/wp-rest-api-schema-validator/src/Middleware.php:641
[01-Jul-2021 23:28:37 UTC] PHP  12. _doing_it_wrong($function = 'register_rest_route', $message = 'The REST API route definition for <code>wp/v2/schemas/(?P<title>\\S+)</code> is missing the required <code>permission_callback</code> argument. For REST API routes that are intended to be public, use <code>__return_true</code> as the permission callback.', $version = '5.5.0') /usr/local/wordpress/wp-includes/rest-api.php:103
[01-Jul-2021 23:28:37 UTC] PHP  13. trigger_error($message = 'register_rest_route was called <strong>incorrectly</strong>. The REST API route definition for <code>wp/v2/schemas/(?P<title>\\S+)</code> is missing the required <code>permission_callback</code> argument. For REST API routes that are intended to be public, use <code>__return_true</code> as the permission callback. Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 5.5.0.)', $error_type = 1024) /usr/local/wordpress/wp-includes/functions.php:5535