Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.1.0
-
None
-
None
-
None
Description
Given the following entity def:
{ "entityDefs": [ { "name": "ExampleType", "superTypes": [], "typeVersion": "0.1", "attributeDefs": [ { "name": "things", "typeName": "array<string>", "cardinality": "SINGLE", "isIndexable": false, "isOptional": false, "isUnique": false } ] } ] }
I can POST a new entity with an empty array for the things attribute successfully:
POST /api/atlas/v2/entity { "entity":{ "typeName":"ExampleType", "attributes":{ "things": [] }, "guid":"-thing", "version":1 } }
But when i GET the entity by guid, the attribute is null instead of the empty list:
GET /api/atlas/v2/entity/guid/d5e33187-3293-4206-bcb8-807dc87c1440 { "referredEntities": {}, "entity": { "typeName": "ExampleType", "attributes": { "things": null }, "guid": "d5e33187-3293-4206-bcb8-807dc87c1440", "status": "ACTIVE", "createdBy": "admin", "updatedBy": "admin", "createTime": 1540335741854, "updateTime": 1540335741854, "version": 1 } }
Atlas should preserve the original value of the create request as an empty list. Returning null here causes further confusion, because the attribute is defined with `isOptional: false` so any consumer of the entity would reasonably expect a non-null value.
I tested this behavior against Atlas versions 1.0.0 and 1.1.0