Clean up image editor REST route. #23368
Merged
Conversation
- Changes the route to `image-editor`. - Returns proper translated errors with status codes. - On success, returns the new media item's full response. - Updates apiFetch call to use `data` instead of manually constructing the JSON body.
Open
@@ -44,22 +44,22 @@ public function register_routes() { | |||
'permission_callback' => array( $this, 'permission_callback' ), | |||
'args' => array( | |||
'x' => array( | |||
'type' => 'float', | |||
'type' => 'number', |
ellatrix
Jun 22, 2020
Member
Strange, using number
failed for me before.
Strange, using number
failed for me before.
ellatrix
Jun 22, 2020
Member
Hm, it seems to work, but what happens then? Is it rounded? Ideally we accept float values here.
Hm, it seems to work, but what happens then? Is it rounded? Ideally we accept float values here.
TimothyBJacobs
Jun 22, 2020
Author
Member
A float
is referred to as a number
in JSON Schema, https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1.
A float
is referred to as a number
in JSON Schema, https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1.
TimothyBJacobs
Jun 22, 2020
Author
Member
More accurate link ( its the v4 spec which we use ) https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
More accurate link ( its the v4 spec which we use ) https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
@@ -44,22 +44,22 @@ public function register_routes() { | |||
'permission_callback' => array( $this, 'permission_callback' ), | |||
'args' => array( | |||
'x' => array( | |||
'type' => 'float', | |||
'type' => 'number', | |||
'minimum' => 0, |
ellatrix
Jun 22, 2020
Member
Is it also possible to specify a maximum?
Is it also possible to specify a maximum?
TimothyBJacobs
Jun 22, 2020
Author
Member
Yep we can use the maximum
property.
Yep we can use the maximum
property.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Description
image-editor
.data
instead of manually constructing the JSON body.How has this been tested?
Manually tested editing an image.
Checklist: