Harmonize internal and extermal representation of items
The described status quo assumes !13 has been merged. Consequently, this issue should only be attacked after said merge.
Current situation
The external (JSON) representation of files and directories must have the property "type" with a value of "file"
or "directory"
, respectively. The internal (dict) representation does not have this key, but the tag if the dict is either 'file'
or 'directory'
.
When receiving external representations (via /bg
POST):
- the external representation is read into a dict (where the tag is a variable)
- it is checked if the "type" key is present with a valid value (done before transformation to give meaningful error messages)
- the "type" key is removed from the dict
- the dict's tag is unified with the value of type
When sending external representations (via /bg
Get):
- the internal representation is retrieved from background knowledge
- it is send as is (This a bug, as we claim that our result conforms to the input specification but we send no "type" property).
Solution
Either
- we add the "type" property/key before sending out internal representations,
- we change our internal representation to include the type in addition to the tag value, or
- we change our internal representation to include the type but use a uniform tag, for example
item
.