mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-01 11:09:14 +00:00
Merge pull request #104 from open-metadata/issue98
Fix #98 Need fullyQualifiedName field for data assets
This commit is contained in:
commit
645cc866fc
@ -218,19 +218,19 @@ public final class EntityUtil {
|
||||
String id = ref.getId().toString();
|
||||
if (entity.equalsIgnoreCase(Entity.TABLE)) {
|
||||
Table instance = EntityUtil.validate(id, tableDAO.findById(id), Table.class);
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getName());
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName());
|
||||
} else if (entity.equalsIgnoreCase(Entity.DATABASE)) {
|
||||
Database instance = EntityUtil.validate(id, databaseDAO.findById(id), Database.class);
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getName());
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName());
|
||||
} else if (entity.equalsIgnoreCase(Entity.METRICS)) {
|
||||
Metrics instance = EntityUtil.validate(id, metricsDAO.findById(id), Metrics.class);
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getName());
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName());
|
||||
} else if (entity.equalsIgnoreCase(Entity.DATABASE_SERVICE)) {
|
||||
Dashboard instance = EntityUtil.validate(id, dashboardDAO.findById(id), Dashboard.class);
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getName());
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName());
|
||||
} else if (entity.equalsIgnoreCase(Entity.REPORT)) {
|
||||
Report instance = EntityUtil.validate(id, reportDAO.findById(id), Report.class);
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getName());
|
||||
return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName());
|
||||
}
|
||||
throw EntityNotFoundException.byMessage(CatalogExceptionMessage.entityTypeNotFound(entity));
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "Name of the entity instance.",
|
||||
"description": "Name of the entity instance. For entities such as tables, database where name is not unique, fullyQualifiedName is returned in this field.",
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
|
||||
@ -63,6 +63,7 @@ import static org.openmetadata.catalog.util.TestUtils.adminAuthHeaders;
|
||||
import static org.openmetadata.catalog.util.TestUtils.assertEntityPagination;
|
||||
import static org.openmetadata.catalog.util.TestUtils.assertResponse;
|
||||
import static org.openmetadata.catalog.util.TestUtils.authHeaders;
|
||||
import static org.openmetadata.catalog.util.TestUtils.validateEntityReference;
|
||||
|
||||
public class TeamResourceTest extends CatalogApplicationTest {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TeamResourceTest.class);
|
||||
@ -497,19 +498,22 @@ public class TeamResourceTest extends CatalogApplicationTest {
|
||||
}
|
||||
|
||||
/** Validate returned fields GET .../teams/{id}?fields="..." or GET .../teams/name/{name}?fields="..." */
|
||||
private void validateGetWithDifferentFields(Team team, boolean byName, Map<String, String> authHeaders)
|
||||
private void validateGetWithDifferentFields(Team expectedTeam, boolean byName, Map<String, String> authHeaders)
|
||||
throws HttpResponseException {
|
||||
// .../teams?fields=profile
|
||||
String fields = "profile";
|
||||
team = byName ? getTeamByName(team.getName(), fields, authHeaders) : getTeam(team.getId(), fields, authHeaders);
|
||||
assertNotNull(team.getProfile());
|
||||
assertNull(team.getUsers());
|
||||
Team getTeam = byName ? getTeamByName(expectedTeam.getName(), fields, authHeaders) : getTeam(expectedTeam.getId(), fields,
|
||||
authHeaders);
|
||||
validateTeam(getTeam, expectedTeam.getDescription(), expectedTeam.getDisplayName(),
|
||||
expectedTeam.getProfile(), null);
|
||||
assertNull(getTeam.getOwns());
|
||||
|
||||
// .../teams?fields=profile,users
|
||||
fields = "profile,users";
|
||||
team = byName ? getTeamByName(team.getName(), fields, authHeaders) : getTeam(team.getId(), fields, authHeaders);
|
||||
assertNotNull(team.getProfile());
|
||||
assertNotNull(team.getUsers());
|
||||
// .../teams?fields=users,owns
|
||||
fields = "users,owns";
|
||||
getTeam = byName ? getTeamByName(expectedTeam.getName(), fields, authHeaders) : getTeam(expectedTeam.getId(), fields, authHeaders);
|
||||
assertNotNull(expectedTeam.getProfile());
|
||||
validateEntityReference(expectedTeam.getUsers());
|
||||
validateEntityReference(expectedTeam.getOwns());
|
||||
}
|
||||
|
||||
private Team patchTeam(UUID teamId, String originalJson, Team updated, Map<String, String> authHeaders)
|
||||
|
||||
@ -168,6 +168,10 @@ public final class TestUtils {
|
||||
assertNotNull(ref.getHref());
|
||||
assertNotNull(ref.getName());
|
||||
assertNotNull(ref.getType());
|
||||
// Ensure data entities use fully qualified name
|
||||
if (List.of("table", "database", "metrics", "dashboard", "pipeline", "report").contains(ref.getName())) {
|
||||
ref.getName().contains("."); // FullyQualifiedName has "." as separator
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateEntityReference(List<EntityReference> list) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user