Page MenuHomeDevCentral

Pick a format for Notifications::$rawContent property
Closed, ResolvedPublic

Description

Follow-up D347:

Phabricator uses a JSON serialization of the array, so a string as rawContent property:

$this->rawContent = json_encode($story);

Other uses directly an object:

$this->rawContent = $payload;

That's not really coherent.

Furthermore, to transform an HTTP query to JSON (Phabricator) is probably okay, but we aren't transforming XML in JSON.

Event Timeline

Currently, D347 is, as far as I know, the first piece of code consuming raw content.

So we can define behavior JSON/string without any issue (and should before other consumers want to explore the original payload).

JSON makes a lot of sense, there is no need to parse twice a JSON payload, once for our notification format, once for the source payload.

But we can have payloads in XML too.

So I advice to add a rawContentFormat property, with a default value of "json-inline". Alternatively, to reuse mime type could be interesting, as such, "application/json" would be defined as inline.

dereckson moved this task from Backlog to Next on the User-Dereckson board.
dereckson added a subscriber: User-Dereckson.
dereckson removed a subscriber: User-Dereckson.

We'll start with inline JSON and we'll advise when new formats pop. JSON is more and more universal.

dereckson claimed this task.