You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by "chaitali borole (Jira)" <ji...@apache.org> on 2021/07/29 12:57:00 UTC

[jira] [Created] (ATLAS-4376) AtlasClientV2 getRelationshipDefByName does not work

chaitali borole created ATLAS-4376:
--------------------------------------

             Summary: AtlasClientV2 getRelationshipDefByName does not work
                 Key: ATLAS-4376
                 URL: https://issues.apache.org/jira/browse/ATLAS-4376
             Project: Atlas
          Issue Type: Improvement
    Affects Versions: 3.0.0
            Reporter: chaitali borole
            Assignee: chaitali borole
             Fix For: 3.0.0


When tried to get the typedef of a relationship by:

atlasClient.getRelationshipDefByName(name)
This will get translated into the following REST request: /api/atlas/v2/types/structdef/name/

{name}

The correct REST request should be: /api/atlas/v2/types/relationshipdef/name/{name}
The reason why it's querying a structdef and not a relationshipdef is due to a bug in AtlasClientV2 line 1135:

} else if (AtlasStructDef.class.isAssignableFrom(typeDefClass)) {
    return "structdef";
} else if (AtlasRelationshipDef.class.isAssignableFrom(typeDefClass)) {
    return "relationshipdef";
Since AtlasRelationshipDef extends AtlasStructDef, the first "if" branch will always be true and the second "if" branch will never happen. The fix for this issue is to reverse the two "if" branches.

provide test cases for all "if" branches to ensure the querying works correctly.



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