[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves
WordPress Trac
noreply at wordpress.org
Fri Mar 30 13:13:27 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):
> > If the shape of the data is the exact same, then we could co-opt the
status attribute to trigger an auto-save (i.e. status=auto-save).
> The shape of the data is identical - its a post thats being saved, both
for posts and for autosaves. The problem with status is an autosave can
have a published or draft status, we need to store the status. In
https://core.trac.wordpress.org/ticket/43316#comment:10 @azaozz proposed
using post type as the 'flag' that triggers an autosave. see 43316.1.diff
I still recommend looking at the '''concept''' you want to model, not how
its data happens to be stored. Putting two models into the same endpoint
because their data happens to be saved in the same way is the wrong way of
doing DRY. As soon as they need to diverge again (posts needing to do
something autosaves shouldn't, or vice-versa) you're facing a big problem
again. You could for example imagine autosaves being stored as incremental
diffs in a separate table through a later optimization.
That's why I recommend a separate `autosaves` endpoint, not some trickery
with posts or revisions. Yes, it can just extend one of the existing
controllers, but the actual public API should cleanly separate the
concepts, not let the current technical implementation bleed through.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43316#comment:54>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list