FS#40963 - "results" value type in JSON response isn't consistent

Attached to Project: AUR web interface
Opened by Dave Reisner (falconindy) - Tuesday, 24 June 2014, 15:42 GMT
Last edited by Lukas Fleischer (lfleischer) - Tuesday, 01 July 2014, 20:03 GMT
Task Type General Gripe
Category Backend
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Architecture All
Severity Low
Priority Normal
Reported Version 3.1.0
Due in Version 3.2.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I noticed this a long time ago, but never brought it up. In retrospect, I wish I had thought of it when we were discussing changes for rpc v2. Maybe something to fix in v3... The problem is that depending on the value of "type" in the RPC response, the JSON type of the "results" key can vary:

here it's a string: https://aur.archlinux.org/rpc.php?v=2&type=search&arg=-git
here it's a list of objects: https://aur.archlinux.org/rpc.php?v=2&type=search&arg=cower
here it's an object: https://aur.archlinux.org/rpc.php?v=2&type=info&arg=cower

From a client perspective, this kind of sucks. I realize that the value of "type" can be used to infer the JSON type of the results, but this is unnecessary since you can always provide a list of objects and resultcount. I'd suggest keeping the error reporting separate from the results. This even makes the "type" field unnecessary since you now have the same generic object structure for all request types.

See attached examples since flyspray eats whitespace.
This task depends upon

Closed by  Lukas Fleischer (lfleischer)
Tuesday, 01 July 2014, 20:03 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in 3.2.0. Please use v3 of the RPC API.
Comment by Lukas Fleischer (lfleischer) - Tuesday, 01 July 2014, 18:29 GMT
  • Field changed: Due in Version (Undecided → 3.2.0)
Fixed in RPC v3, see 65129ce (Make results consistent in RPC replies, 2014-06-25).

Loading...