We are generally using mime types (content-type header) to version content types. This is very important especially for stored content:
- The format of stored HTML / JSON might change, requiring a format migration.
- Security issues might have left dangerous content in HTML we store. We'll need to re-run the serializer (via T114413) and migrate to the latest HTML mime type.
There are special considerations when comparing mime types, which are discussed in https://github.com/wikimedia/restbase/pull/312#discussion_r39576615. In short: We'll have to normalize the content-type before comparing. The content-type module might come in handy for this.
If the comparison fails, there are two main ways to handle this:
- Repeat the request with cache-control: no-cache: This is a fairly universal mechanism that should work out of the box, for example for Parsoid. The downside is that this might be a very expensive way to upgrade content, and it might not actually result in the same content, for example when templates are re-expanded.
- Call a specific migration service, like the html2html end point described for Parsoid in T114413. Then, save the response back to the database.