Page MenuHomePhabricator

Line-wrap help/error info in &format=jsonfm
Closed, ResolvedPublic

Description

Author: herd

Description:
The error warning currently adds an additional 74k (15k gzipped) of text to a query in the form of the help page. I often code for streamlineyness and quickness especially in javascript run client-side on page loads, and when I get an error I usually only care about the error itself, and the text of the error is ignored.

Could a parameter be created to suppress the showing of help on error? Or possibly this could be default behavior for format=json/jsonfm and some other esoteric situations where the error is not even human readable, as in the example.


Version: 1.14.x
Severity: enhancement
URL: http://test.wikipedia.org/w/api.php?action=query&format=jsonfm&list=logevents&leuser=NOSUCHUSER

Details

Reference
bz16422

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:26 PM
bzimport set Reference to bz16422.

(In reply to comment #0)

The error warning currently adds an additional 74k (15k gzipped) of text to a
query in the form of the help page.

This only happens when using an *fm format. Formats like json (not jsonfm) don't show the help page unless you specifically asked for it through action=help. Assuming your JavaScript application uses format=json rather than jsonfm, you won't have this problem.

herd wrote:

Reopening and retitling.

http://en.wikipedia.org/w/api.php?action=flibble&format=xml <-- useful error

http://en.wikipedia.org/w/api.php?action=flibble&format=xmlfm <-- useful help

http://en.wikipedia.org/w/api.php?action=flibble&format=json <-- useful error

http://en.wikipedia.org/w/api.php?action=flibble&format=jsonfm <-- this help is useless

Per IRC: json can convert /\n/ to something like "\"\n\t + \""

foo = "foo bar baz"

+ "foo bar baz"

This then would actually be legible in jsonfm, and still valid after copy/paste

(In reply to comment #2)

Per IRC: json can convert /\n/ to something like "\"\n\t + \""

foo = "foo bar baz"

+ "foo bar baz"

This then would actually be legible in jsonfm, and still valid after copy/paste

But it wouldn't be valid json text according to RFC 4627, if that matters to you.

(In reply to comment #3)

But it wouldn't be valid json text according to RFC 4627, if that matters to
you.

You're right: RFC 4627 does not allow breaking up JSON strings in any way. Marking as WONTFIX for this reason.

herd wrote:

But the help doesn't exist in format=json, this is jsonfm.

Why not just remove the help from jsonfm then? it seems quite useless.

(In reply to comment #5)

But the help doesn't exist in format=json, this is jsonfm.

Why not just remove the help from jsonfm then? it seems quite useless.

Removed in r50000

herd wrote:

Thank you(In reply to comment #6)

(In reply to comment #5)

But the help doesn't exist in format=json, this is jsonfm.

Why not just remove the help from jsonfm then? it seems quite useless.

Removed in r50000

Yay! My hero ^_^