https://bugzilla.wikimedia.org/show_bug.cgi?id=70832

Yuri Astrakhan <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|JSONContent::getJsonData()  |Improve JSONContent before
                   |should return an object,    |releasing 1.24
                   |not array                   |

--- Comment #1 from Yuri Astrakhan <[email protected]> ---
I will put all of my jsoncontent-related concerns here for discussion.

* By default, data model should use [] <=> array,  and {} <=> stdClass
conversion, without forcing {} into arrays. This guarantees perfect
round-tripping json->php->json, without breaking on empty objects. MW API has
had suffered due to this, lots of complaints :)

* Validation needs to be improved. true/false is not sufficient for validation,
need Status object. Status supports notions of "parsable" (valid json), vs
"valid" (passes domain-specific validation, e.g. json schema or custom code).
Status also supports localized error reporting with more than one issue.

* Separate storage and rendering.  Content object is for storage, and when
Content::getHtml() is called, its rendering should be done in some other class.

* By default, lets not use visualize JSON as table - this might work in some
cases, but it is not easily copiable (without hitting edit). I propose using
<syntaxhighlight lang="json">...</syntaxhighlight> if geshi is available, or
<code> otherwise.

* JSON should be stored in its compact form, but edited and rendered as
"prety-printed".

* It should be possible to store invalid JSON (similar to how it is possible to
store Scribunto's Lua code even when it doesn't validate). This is needed when
JSON page is used as a template for transclusion into other pages. Example: 
{"key":{{{1}}} }  <-- in this case we obviously skip all the "prety-print"
conversions.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to