Open toomim opened 1 year ago
Note: this is a counter-proposal to https://github.com/braid-org/braid-spec/pull/120
Rahul (@cxres) pointed out a problem with my thinking here: Content-Type describes the content of the HTTP message, not the resource. Specifically:
HTTP/1.1 200 OK
Header1: value1
Header2: value2
this is content <--- "content" is the stuff after the newline
That means that if we put a patch in the content
section, we need the Content-Type: header to describe that patch.
But we still need a way to communicate the mime-type that the patch is applying to. So perhaps we just need two headers, like:
Content-Type: application/range-patch
Representation-Type: application/json
Or a hybrid parameterized patch type, like:
Content-Type: application/range-patch(on: application/json)
(Chair:) Since this has gotten more complicated, I don't think we can resolve it in time for draft 03, and I'm removing it from that milestone.
The spec currently specifies custom patch types in the same way that the HTTP PATCH method does: using the
Content-Type
header.But this sucks, because it clobbers other uses of Content-Type that we care about.
This rules out these use-cases:
text/markdown
that gets rendered intoapplication/html
), can't specify which representation it wants its patch to apply toPatches: N
, where there is not existing definition of content-type.So I propose that we ignore how PATCH does things, and introduce an actual
Patch-Type
header for patch types. This PR makes the change. We only need to change 6 lines.(More context in https://braid.org/meeting-69/http-patch-design)