REST Template BaseHandler Defaults don't pass all arguments to renderData, and jsonQueryFormat default

Description

In trying to get the Coldbox REST template to serialize a query as a struct rather than the default behavior, I found that I could call renderData directly and do this, but that the default behavior of the BaseHandler was almost sufficient – it just wasn't passing the jsonQueryFormat argument to renderData (and then on to DataMarshaller).

Also, the default value for jsonQueryFormat in Response.cfc is "query" which does not appear to be valid. DataMarshaller has the CF docs which explain the mystifying values it can accept per https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/serializejson.html

false (default): a "row-oriented JSON Object" with COLUMNS and DATA as a two-dimensional array
true: "a column-oriented JSON object ... equivalent to WDDX query representation" where DATA is an object
"row"
"column"
"struct"

this is horrible but it is what it is and DataMarshaller sets a default of true – it's just Response.cfc that has "query" as a default, which seems to do nothing (at least on ACF11) and it falls back to the the same behavior as false.

I have fixes for both of these.

Activity

Show:
Luis Majano
April 12, 2018, 9:44 PM

Send them over

Samuel W. Knowlton
April 13, 2018, 12:43 PM

I think there are a couple templates using BaseHandler and Response.cfc. I'll do https://github.com/coldbox-templates/rest unless there's a better one.

Samuel W. Knowlton
April 13, 2018, 1:01 PM
Fixed

Assignee

Samuel W. Knowlton

Reporter

Samuel W. Knowlton

Labels

None

Time remaining

0m

Components

Affects versions

Priority

Minor
Configure