Fix - Existing custom properties getting removed on import of empty extension column (#19234)

This commit is contained in:
sonika-shah 2025-01-05 23:16:14 +05:30 committed by GitHub
parent 1c793cc268
commit 0d3393c3c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -2840,6 +2840,13 @@ public abstract class EntityRepository<T extends EntityInterface> {
return;
}
if (operation == Operation.PUT && updatedExtension == null) {
// Revert change to non-empty extension if it is being updated by a PUT request
// For PUT operations, existing extension can't be removed.
updated.setExtension(origExtension);
return;
}
List<JsonNode> added = new ArrayList<>();
List<JsonNode> deleted = new ArrayList<>();
JsonNode origFields = JsonUtils.valueToTree(origExtension);

View File

@ -211,7 +211,8 @@ public class MlModelRepository extends EntityRepository<MlModel> {
.getFeatureSources()
.forEach(
mlFeatureSource -> {
EntityReference targetEntity = getEntityReference(mlFeatureSource.getDataSource(), Include.ALL);
EntityReference targetEntity =
getEntityReference(mlFeatureSource.getDataSource(), Include.ALL);
if (targetEntity != null) {
addRelationship(
targetEntity.getId(),