mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 11:39:12 +00:00
* Fix #8083: Adding a child term to a parent term in glossary produces error * checkstyle fix Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com>
This commit is contained in:
parent
00375341f7
commit
0050243479
@ -102,6 +102,10 @@ public class GlossaryTermRepository extends EntityRepository<GlossaryTerm> {
|
||||
|
||||
@Override
|
||||
public void prepare(GlossaryTerm entity) throws IOException {
|
||||
// Validate parent term
|
||||
EntityReference parentTerm = Entity.getEntityReference(entity.getParent());
|
||||
entity.setParent(parentTerm);
|
||||
|
||||
validateHierarchy(entity);
|
||||
|
||||
// Validate glossary
|
||||
@ -111,10 +115,6 @@ public class GlossaryTermRepository extends EntityRepository<GlossaryTerm> {
|
||||
// If reviewers is not set in the glossary term, then carry it from the glossary
|
||||
entity.setReviewers(entity.getReviewers() == null ? glossary.getReviewers() : entity.getReviewers());
|
||||
|
||||
// Validate parent term
|
||||
EntityReference parentTerm = Entity.getEntityReference(entity.getParent());
|
||||
entity.setParent(parentTerm);
|
||||
|
||||
// Validate related terms
|
||||
EntityUtil.populateEntityReferences(entity.getRelatedTerms());
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@ import static org.openmetadata.service.resources.databases.TableResourceTest.get
|
||||
import static org.openmetadata.service.util.EntityUtil.fieldAdded;
|
||||
import static org.openmetadata.service.util.EntityUtil.fieldDeleted;
|
||||
import static org.openmetadata.service.util.EntityUtil.fieldUpdated;
|
||||
import static org.openmetadata.service.util.EntityUtil.getEntityReference;
|
||||
import static org.openmetadata.service.util.EntityUtil.getId;
|
||||
import static org.openmetadata.service.util.EntityUtil.toTagLabels;
|
||||
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
|
||||
@ -366,7 +365,11 @@ public class GlossaryTermResourceTest extends EntityResourceTest<GlossaryTerm, C
|
||||
public GlossaryTerm createTerm(
|
||||
Glossary glossary, GlossaryTerm parent, String termName, List<EntityReference> reviewers) throws IOException {
|
||||
EntityReference glossaryRef = glossary.getEntityReference();
|
||||
EntityReference parentRef = getEntityReference(parent);
|
||||
// sending required fields only for entity reference
|
||||
EntityReference parentRef = null;
|
||||
if (parent != null) {
|
||||
parentRef = new EntityReference().withId(parent.getId()).withType(GLOSSARY_TERM);
|
||||
}
|
||||
CreateGlossaryTerm createGlossaryTerm =
|
||||
createRequest(termName, "", "", null).withGlossary(glossaryRef).withParent(parentRef).withReviewers(reviewers);
|
||||
return createAndCheckEntity(createGlossaryTerm, ADMIN_AUTH_HEADERS);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user