DSAPI provides support for 2 JSON modes, compact or complete, the latter being the default if nothing is specified. Extracted from the DSAPI docs (https://github.com/epimorphics/data-API/wiki/Data-Query-Syntax) is this info on JSON modes:
"@json_mode": S, S is the string "complete" or the string "compact". Complete mode is
equivalent having both "@suppress_types": true and "@compact_optionals": true. The default
vale is "complete".
The PPD app was including the field @json_mode: "compact" in the query, while the UKHPI app doesn't specify it, thus defaulting to @json_mode: "complete". The gem currently only supports @json_mode: "compact" when converting the results from SAPINT format to DSAPI format; support for @json_mode: "complete" needs to be added as part of this issue.
The main differences between the 2 JSON modes are:
- all values that are not a Hash are returned as an array for JSON mode complete, example:
housePrice: [123.45] , compared to: housePrice: 123.45 for compact mode
- empty fields are also wrapped in an array for complete mode, as such:
housePrice: [], while the compact mode doesn't display them at all (SAPINT doesn't return empty fields as results, so this won't be supported, the fields will simply not be present in this case, which is fine with the LR apps)
There are a few nuances about the complete mode where 4 cases need to be treated differently:
- the SAPINT response for
refMonth is a value, example: 2020-02, DSAPI returns:
"ukhpi:refMonth": {
"@value": "2020-02",
"@type": "http://www.w3.org/2001/XMLSchema#gYearMonth"
}
for that field; the SAPINT response needs to be converted to the DSAPI format (the type can be omitted here as it is never used in the LR apps)
- the
@ids will not be wrapped in an array, so @id: example.com will be the same for both JSON modes
- any hash returned by SAPINT will be preserved as is in the "DSAPI" response
- finally, for the
refPeriodStart field SAPINT returns a value, example 2020-12-01, while DSAPI returns:
"ukhpi:refPeriodStart": [
{
"@value": "2020-02-01",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}
]
for that field; the SAPINT response needs to be converted to the DSAPI format (again, the type can be omitted here as it is never used in the LR apps)
Also, any Hash that is in the SAPINT response will be preserved as it is in the "DSAPI" response.
Note:
- "DSAPI" means SAPINT results converted to the DSAPI format (what the LR apps expect to receive, thinking they still talk with DSAPI)
- DSAPI means the actual DSAPI
DSAPI provides support for 2 JSON modes, compact or complete, the latter being the default if nothing is specified. Extracted from the DSAPI docs (https://github.com/epimorphics/data-API/wiki/Data-Query-Syntax) is this info on JSON modes:
"@json_mode": S,Sis the string"complete"or the string"compact". Complete mode isequivalent having both
"@suppress_types": trueand"@compact_optionals": true. The defaultvale is
"complete".The PPD app was including the field
@json_mode: "compact"in the query, while the UKHPI app doesn't specify it, thus defaulting to@json_mode: "complete". The gem currently only supports@json_mode: "compact"when converting the results from SAPINT format to DSAPI format; support for@json_mode: "complete"needs to be added as part of this issue.The main differences between the 2 JSON modes are:
housePrice: [123.45], compared to:housePrice: 123.45for compact modehousePrice: [], while the compact mode doesn't display them at all (SAPINT doesn't return empty fields as results, so this won't be supported, the fields will simply not be present in this case, which is fine with the LR apps)There are a few nuances about the complete mode where 4 cases need to be treated differently:
refMonthis a value, example:2020-02, DSAPI returns:for that field; the SAPINT response needs to be converted to the DSAPI format (the type can be omitted here as it is never used in the LR apps)
@ids will not be wrapped in an array, so@id: example.comwill be the same for both JSON modesrefPeriodStartfield SAPINT returns a value, example2020-12-01, while DSAPI returns:for that field; the SAPINT response needs to be converted to the DSAPI format (again, the type can be omitted here as it is never used in the LR apps)
Also, any Hash that is in the SAPINT response will be preserved as it is in the "DSAPI" response.
Note: