WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

Font Library: refactor REST API #55278

Closed matiasbenedetto closed 9 months ago

matiasbenedetto commented 1 year ago

What?

Font Library: refactor REST API endpoints.

Refactor REST endpoint URLs

(reference reference). PR:

Transition the Font Family APIs to be SINGULAR

(accepting as parameters and returning as responses a single Font Family item) (reference reference )

PR:

Return a single Error (with multiple calls to add())

instead of a collection of errors. (reference reference )

Return API responses with rest_ensure_response instead of new WP_REST_Response()

(reference)

Ensure there is error handling of any decoded JSON string

( reference )

Add schema's to the requests

(reference)

Break the font library REST API controller in 2 controllers.

One for font families and one for font collections. (reference)

PR:

Error code strings need to be translated

([reference]).

Ensure the gutenberg domain used for translations is removed when porting to core.

(reference)

Why?

To standardize the endpoint routes and input/output data formats and schemas.

How?

This task is somewhat big, so multiple PRs for it are expected.


Props to all the folks that brought this issue in this PR: https://github.com/WordPress/wordpress-develop/pull/5285

creativecoder commented 10 months ago

Note that I've outlined a proposed API design used for this refactoring effort in https://github.com/WordPress/gutenberg/issues/57616

mikachan commented 9 months ago

Can this be closed now that https://github.com/WordPress/gutenberg/pull/57688 is merged?

matiasbenedetto commented 9 months ago

Yep, let's close it and work over more granular issues.