Cade Parker created ATLAS-2933:
----------------------------------
Summary: Empty array attributes are returned as null instead of an
empty list
Key: ATLAS-2933
URL: https://issues.apache.org/jira/browse/ATLAS-2933
Project: Atlas
Issue Type: Bug
Affects Versions: 1.1.0
Reporter: Cade Parker
Given the following entity def:
{code:java}
{
"entityDefs": [
{
"name": "ExampleType",
"superTypes": [],
"typeVersion": "0.1",
"attributeDefs": [
{
"name": "things",
"typeName": "array<string>",
"cardinality": "SINGLE",
"isIndexable": false,
"isOptional": false,
"isUnique": false
}
]
}
]
}
{code}
I can POST a new entity with an empty array for the things attribute
successfully:
{code:java}
POST /api/atlas/v2/entity
{
"entity":{
"typeName":"ExampleType",
"attributes":{
"things": []
},
"guid":"-thing",
"version":1
}
}
{code}
But when i GET the entity by guid, the attribute is null instead of the empty
list:
{code:java}
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
}
}
{code}
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
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)