[ 
https://issues.apache.org/jira/browse/ATLAS-2215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16995154#comment-16995154
 ] 

Logan Rickert commented on ATLAS-2215:
--------------------------------------

[~madhan] Thank you for replying. I think I have narrowed down the issue some 
more while creating some examples for you. I've only been testing with the key 
value 'schema' because that is what was used in the only example JSON I could 
find for structures with entities. Changing the key value to something other 
than 'schema' (in this case 'testArrayB') appears to not give the error. It's 
possible that 'schema' is a reserved key value and was just not known to me.

 

[http://localhost:21000/api/atlas/v2/types/typedefs]

 

 
{code:java}
// Creating entities from this def works as expected

{
  "entityDefs" : [
    {
      "superTypes" : [ "DataSet" ],
      "category" : "ENTITY",
      "name" : "DataSetTestA",
      "description" : "description",
      "typeVersion" : "1.0",
      "attributeDefs" : [
       {
          "name" : "testArrayA",
          "typeName" : "array<string>",
          "isOptional" : true,
          "cardinality" : "SINGLE",
          "valuesMinCount" : 1,
          "valuesMaxCount" : 1,
          "isUnique" : false,
          "isIndexable" : false
        }      ]
    }
  ]
}
{code}
 

 
{code:java}
// Creating an entity from this def also works. I was surprised by this because 
I had only tried with the key 'schema' when making an array type. Using a key 
other than schema (in this case testArrayB) did not give me an error.

"structDefs": [
    {
      "category": "STRUCT",
      "name": "testStructB",
      "description": "description",
      "typeVersion": "1.0",
      "attributeDefs": [
        {
          "name": "testAttribute",
          "typeName": "string",
          "isOptional": false,
          "cardinality": "SINGLE",
          "valuesMinCount": 1,
          "valuesMaxCount": 1,
          "isUnique": false,
          "isIndexable": false
        }
      ]
    }
  ],
  "entityDefs" : [
    {
      "superTypes" : [ "DataSet" ],
      "category" : "ENTITY",
      "name" : "DataSetTestB",
      "description" : "description",
      "typeVersion" : "1.0",
      "attributeDefs" : [
       {
          "name" : "testArrayB",
          "typeName" : "array<testStructB>",
          "isOptional" : true,
          "cardinality" : "SINGLE",
          "valuesMinCount" : 1,
          "valuesMaxCount" : 1,
          "isUnique" : false,
          "isIndexable" : false
        }
      ]
    }
  ]
}
{code}
 

 
{code:java}
// Creating an entity from this def will fail with an error

{
  "structDefs": [
    {
      "category": "STRUCT",
      "name": "testStructC",
      "description": "column definition for schema",
      "typeVersion": "1.0",
      "attributeDefs": [
        {
          "name": "testAttribute",
          "typeName": "string",
          "isOptional": false,
          "cardinality": "SINGLE",
          "valuesMinCount": 1,
          "valuesMaxCount": 1,
          "isUnique": false,
          "isIndexable": false
        }
      ]
    }
  ],
  "entityDefs" : [
    {
      "superTypes" : [ "DataSet" ],
      "category" : "ENTITY",
      "name" : "DataSetTestC",
      "description" : "description",
      "typeVersion" : "1.0",
      "attributeDefs" : [
       {
          "name" : "schema",
          "typeName" : "array<testStructC>",
          "isOptional" : true,
          "cardinality" : "SINGLE",
          "valuesMinCount" : 1,
          "valuesMaxCount" : 1,
          "isUnique" : false,
          "isIndexable" : false
        }
      ]
    }
  ]
}
{code}
 

 

 

[http://localhost:21000/api/atlas/v2/entity/bulk]

 

 
{code:java}
// This post works

{
  "entities": [
    {
      "typeName": "DataSetTestA",
      "createdBy": "admin",
      "guid": -100,
      "attributes": {
        "qualifiedName": "qualifiedName123",
        "uri": "url123",
        "name": "name123",
        "testArrayA":[
                "test", "test2", "test3"
        ]
      }
    }
  ]
}
{code}
 

 
{code:java}
// This post works

{
  "entities": [
    {
      "typeName": "DataSetTestB",
      "createdBy": "admin",
      "guid": -100,
      "attributes": {
        "qualifiedName": "qualifiedName456",
        "uri": "url456",
        "name": "name456",
        "testArrayB":[
            {"testAttribute": "testValue1"},
            {"testAttribute": "testValue2"}
        ]
      }
    }
  ]
}
{code}
{code:java}
// This post does NOT work. "errorMessage": "ObjectId is not valid 
AtlasObjectId{guid='null', typeName='null', uniqueAttributes={}}"

{
  "entities": [
    {
      "typeName": "DataSetTestC",
      "createdBy": "admin",
      "guid": -100,
      "attributes": {
        "qualifiedName": "qualifiedName789",
        "uri": "url789",
        "name": "name789",
        "schema":[
            {"testAttribute": "testValue1"},
            {"testAttribute": "testValue2"}
        ]
      }
    }
  ]
}
{code}
 

 

> UI: Editing array of Structs behave as array of entity references
> -----------------------------------------------------------------
>
>                 Key: ATLAS-2215
>                 URL: https://issues.apache.org/jira/browse/ATLAS-2215
>             Project: Atlas
>          Issue Type: Bug
>          Components: atlas-webui
>    Affects Versions: 1.0.0
>            Reporter: Pierre Padovani
>            Priority: Major
>
> Reproduction steps:
> * create a struct with a set of attributes
> * create an entity type with an attribute defined as an array of the 
> previously defined struct
> * Attempt to create an instance of the entity and set the struct value. It 
> will behave as if the type is an array of entities and not a free form field.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to