Summary
The request GET /origdatablocks/fullquery/files return dataFileList object as a JSON dict and not an array.
This results in an inconsistent result with OutputOrigDatablockDTO.
Current Behaviour
{
"_id": "1b2XXX",
"createdBy": "",
"updatedBy": "",
"ownerGroup": "",
"accessGroups": [],
"isPublished": false,
"datasetId": "DS-XX",
"size": 0,
"chkAlg": "blake2d",
"dataFileList": {
"path": "XX.nxs",
"size": 0,
"time": "",
"chk": "XX",
"_id": "69eXXXX"
},
"createdAt": "",
"updatedAt": "",
"__v": 0,
"datasetExist": true
}
Expected Behaviour
{
....
"dataFileList": [
{
"path": "XX.nxs",
"size": 0,
"time": "",
"chk": "XX",
"_id": "69eXXXX"
},
],
}
Details
While the request is expected to return an OrigDatablock with only a single datafile in the dataFileList, it seems more adequate to maintain the dataFileList array format.
This useful to have more consistent schema at the frontend side instead of using just an object[] type .
see FileState
Also there is a risque of { $unwind: "$dataFileList" } at return multiple dataFileList objects like:
{ dataFileList: A }
{ dataFileList: B }
{ dataFileList: C }
Summary
The request
GET /origdatablocks/fullquery/filesreturndataFileListobject as a JSON dict and not an array.This results in an inconsistent result with
OutputOrigDatablockDTO.Current Behaviour
{ "_id": "1b2XXX", "createdBy": "", "updatedBy": "", "ownerGroup": "", "accessGroups": [], "isPublished": false, "datasetId": "DS-XX", "size": 0, "chkAlg": "blake2d", "dataFileList": { "path": "XX.nxs", "size": 0, "time": "", "chk": "XX", "_id": "69eXXXX" }, "createdAt": "", "updatedAt": "", "__v": 0, "datasetExist": true }Expected Behaviour
{ .... "dataFileList": [ { "path": "XX.nxs", "size": 0, "time": "", "chk": "XX", "_id": "69eXXXX" }, ], }Details
While the request is expected to return an
OrigDatablockwith only a single datafile in thedataFileList, it seems more adequate to maintain thedataFileListarray format.This useful to have more consistent schema at the frontend side instead of using just an
object[]type .see FileState
Also there is a risque of
{ $unwind: "$dataFileList" }at return multipledataFileListobjects like: