Last modified: 2014-11-12 15:54:33 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T72832, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70832 - Improve JSONContent before releasing 1.24
Improve JSONContent before releasing 1.24
Status: NEW
Product: MediaWiki
Classification: Unclassified
ContentHandler (Other open bugs)
1.24rc
All All
: High normal (vote)
: 1.24.0 release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-14 22:10 UTC by Kunal Mehta (Legoktm)
Modified: 2014-11-12 15:54 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2014-09-14 22:10:01 UTC
Per quick discussion with Yurik on IRC. We want to do this before the 1.24 release is stable.
Comment 1 Yuri Astrakhan 2014-09-14 22:35:12 UTC
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.
Comment 2 Alex Monk 2014-09-14 23:33:51 UTC
(In reply to Yuri Astrakhan from comment #1)
> * 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.

Geshi support is added by [[mw:Extension:SyntaxHighlight_GeSHi]], let's not do if ( $extension ) { ... } else { ... } in core.
I actually quite like the table, I'm sure we can still provide some way to copy it in action=view without needing to kill the table.
Comment 3 Yuri Astrakhan 2014-09-14 23:52:53 UTC
Alex, I am totally ok with the table, but I don't want to duplicate it - I have substantially improved upon Ori's original table code to be more extendable and support validation and other styling. Hence, I would rather have the core provide bare minimum, e.g. render it with <code>...</code>, and let the extension render it in a more visual way. I agree that if (ext) {} else {} should not be in core. This is similar to the code editor - it greatly improves the json editing experience, but we shouldn't rely on it.
Comment 4 Mark A. Hershberger 2014-11-12 15:54:33 UTC
Any news on what you guys have done for this?  1.24 is imminent.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links