[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves
WordPress Trac
noreply at wordpress.org
Fri Mar 30 15:06:49 UTC 2018
#43316: REST API: Support autosaves
-------------------------------------------------+-------------------------
Reporter: kraftbj | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-unit- | Focuses: rest-api
tests |
-------------------------------------------------+-------------------------
Comment (by schlessera):
Just want to add the distinction that I wasn't talking about controllers
above. It is pretty irrelevant how we split up controllers and where we
put them. That's a technical detail in the REST API black box and can be
changed at will.
What matters are the endpoints. I think that a `POST /posts/` is a
different concept than a `POST /autosaves/`. Yes, they share the same code
and data model, and yes, they can happily use the same controller (for
now). The thing is that the action that the client requests is a different
one, and should be expressed in that way. All the other discussions are
details that the client does not need to know.
When we now split up `/posts/` to mean "trigger saving a post" AND
"trigger saving an autosave", that is just immediate technical debt and
raises the complexity in an unneeded way. And yes, adding a separate
endpoint means having a bit more code, but the complexity actually gets
lowered, because we have less branching in one individual code path. Most
importantly, though, it doesn't need a rewrite of the client in case the
handling of "trigger saving a post" and "trigger saving an autosave"
should later diverge.
The above being said, I'm not the one in a position to decide here, I just
wanted to make sure my concerns are heard. I thought that we had already
previously agreed to go with a separate `/autosaves/` endpoint (as it
seems the more future-safe approach, regardless of any other factors), but
I'm happy to help refine whatever approach you finally plan to commit.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43316#comment:56>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list