We are getting ready to integrate Parsoid with RESTBase. This task tracks our progress and what's left to do.
Generally, we need a way to communicate multiple mime entities both in POST requests to Parsoid, and in responses from Parsoid back to RESTBase. We could use [RFC 2387](https://tools.ietf.org/html/rfc2387) or [RFC 2388](https://www.ietf.org/rfc/rfc2388.txt), but this seems to be a bit cumbersome especially for the response part. Instead, we can just use a simple JSON encoding with a structure that's otherwise basically identical to MIME.
The downside of using JSON is possibly efficiency (quite a bit more escaping going on, especially for HTML-in-JSON). However, we could address that later by optionally using a binary encoding like [msgpack](http://msgpack.org/) without changing the message structure itself.
Another option to consider would be to flatten the structure by using names like `original.html`. This would make it easy to encode the same message as `multipart/related`.
== Status ==
=== On-demand generation of HTML and data-parsoid ===
Task: https://phabricator.wikimedia.org/T88456?workflow=75955
- Parsoid: Slightly simpler format done & deployed. Needs to be updated to indicate the mime types as documented above.
- RESTBase: Prototype implementation.
- should pass to Parsoid:
- previous revision's HTML + data-parsoid OnEdit
- current revision's HTML + data-parsoid OnDependencyChange
=== html2wt conversion support ===
Task: https://phabricator.wikimedia.org/T88457?workflow=75955
- Parsoid WIP implementation: https://gerrit.wikimedia.org/r/#/c/165685/
- RESTBase to be done
* [ ] augment the POST /{domain}/v1/transform/<html|wt>/to/html endpoint to:
* [ ] allow an optional bodyOnly field **-- PR in [[ https://github.com/wikimedia/restbase/pull/153 | restbase#153 ]]**
* [x] accept an application/json body
* [ ] accept a multipart/form-data body **-- PR in [[ https://github.com/wikimedia/restbase/pull/154 | restbase#154 ]]**
* [ ] add html-to-wikitext support
* [ ] store wt //-- see [[ https://github.com/wikimedia/parsoid/blob/master/lib/mediawiki.ApiRequest.js#L224 | how Parsoid gets wt from the MW API ]]//