w3c / Micropub

The Micropub spec
https://micropub.net/draft/
97 stars 23 forks source link

Discuss using ActivityPub syntax for updates/deletes #22

Closed aaronpk closed 8 years ago

aaronpk commented 8 years ago

At the MIT face-to-face, we discussed using the ActivityPub syntax for updates and deletes.

See more discussion here: http://socialwg.indiewebcamp.com/irc/social/2016-03-17#t1458235425910

aaronpk commented 8 years ago

I've started working on a draft that uses the new syntax. You can read it here: http://micropub.net/draft/socialpub/#update Compare with the existing syntax here: http://micropub.net/draft/#update

I'm on the fence about whether this is actually a useful change. Currently there are at least two implementations of the current syntax. One is my client and server, the other is from someone I've never met, who just read the spec and implemented it. Here is their client and server.

For context, the simple case of creating a post is going to always support form-encoded as well as JSON post body. However, for updates, that is TBD.

Here is a summary of the current issues that need to be decided:

valpackett commented 8 years ago

Lack of support for multiple operations in one request would be really horrible for micro-panel!

Why not just use RFC 6902 JSON Patch? There are libraries (e.g. jsonpatch.js, aeson-diff) that implement it, which means less code in micropub endpoint implementations.

aaronpk commented 8 years ago

@myfreeweb there was some previous discussion on using JSONPatch, but it ends up being kind of awkward for some things. See the thread in #5 and some comments on the wiki: http://indiewebcamp.com/micropub-edit-examples#JSON_Patch

barryf commented 8 years ago

Given the current small number of implementations I wonder whether limiting support to just the JSON format would help adoption. I'd prefer not to test both formats unless necessary.

The single-operation ActivityStreams approach fits with how I intend to use Micropub for modifying one post at a time and would also make it simpler to write clients in terms of testing and error-handling.

valpackett commented 8 years ago

The current multi-operation syntax is also modifying one post at a time!

It allows this:

{
  "mp-action": "update",
  "url": "http://example.com/post/1",
  "replace": {
    "content": ["hello moon"]
  },
  "delete": {
    "category": ["indieweb"]
  },
  "add": {
    "category": ["webmention"]
  }
}

To be one atomic operation.

barryf commented 8 years ago

Ah, I misunderstood. If the ActivityStreams-style format requires separate requests for each property change I'd prefer the existing method.

valpackett commented 8 years ago

Not for each property change. For each type of change (replace/delete/add).

barryf commented 8 years ago

OK, so in your example you would still need to make three requests with ActivityStreams style for each of replace, delete and add.

aaronpk commented 8 years ago

I do like that restricting updates use the JSON format means one less thing to implement and test for the server. I also don't see many advantages to supporting form-encoded requests for update, other than it being slightly easier to make form-encoded requests from the curl command line, which is really a minor use case.

@myfreeweb you mentioned earlier that it wasn't much work for you to support both formats. Would it have been any easier to not support the form-encoded format for updates? Would you prefer to only have to maintain one code path? If we do end up supporting both formats in the spec, it means a server is going to have to support both in order to interoperate with the most number of clients, since a client will likely have only implemented one version.

valpackett commented 8 years ago

My server currently supports both, but of course it would be easier if only one format was required.

cwebber commented 8 years ago

@barryf In activitypub, what you would do is replace the entire activity at once with the new updated one.

However, I think @rhiaro had ideas on how to do incremental updates micropub style using the activitystreams syntax, possibly with a bit of additional vocabulary. Amy? Update: Sorry, that was on the follow / subscribe stuff. I do seem to remember this coming up though?

aaronpk commented 8 years ago

Resolved in the f2f to use current micropub syntax and not adopt AS2 syntax.