You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/08/13 00:52:00 UTC
[jira] [Commented] (ATLAS-2933) Empty array attributes are returned
as null instead of an empty list
[ https://issues.apache.org/jira/browse/ATLAS-2933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16905704#comment-16905704 ]
ASF subversion and git services commented on ATLAS-2933:
--------------------------------------------------------
Commit ae4305d624ba82d7cd2af607c1c229177ededfc2 in atlas's branch refs/heads/master from Le Ma
[ https://gitbox.apache.org/repos/asf?p=atlas.git;h=ae4305d ]
ATLAS-2933-2 Fix for changed behavior of empty arr attributes
Signed-off-by: Sarath Subramanian <sa...@apache.org>
> 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
> Assignee: Le Ma
> Priority: Major
> Attachments: ATLAS-2933.patch
>
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
>
> 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.14#76016)