diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java index ac3df2535f..5bddc4c0da 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java @@ -110,7 +110,9 @@ private void processCreateContract(AtlasEntity entity, EntityMutationContext con boolean contractSync = syncContractCertificateStatus(entity, contract); contractString = DataContract.serialize(contract); - entity.setAttribute(ATTR_CONTRACT, contractString); + if (!isContractYaml(entity)) { + entity.setAttribute(ATTR_CONTRACT, contractString); + } String contractStringJSON = DataContract.serializeJSON(contract); entity.setAttribute(ATTR_CONTRACT_JSON, contractStringJSON); @@ -298,4 +300,8 @@ private static String getContractString(AtlasEntity entity) { } return contractString; } + + private static boolean isContractYaml(AtlasEntity entity) { + return !StringUtils.isEmpty((String) entity.getAttribute(ATTR_CONTRACT)); + } }