mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-17 04:52:17 +00:00
* Fixed adding more than 10 tags at a time
This commit is contained in:
parent
d799d792a2
commit
3a7de3c677
@ -183,12 +183,46 @@ public final class JsonUtils {
|
|||||||
|
|
||||||
// sort the operations by path
|
// sort the operations by path
|
||||||
if (!otherOperations.isEmpty()) {
|
if (!otherOperations.isEmpty()) {
|
||||||
otherOperations.sort(Comparator.comparing(jsonObject -> jsonObject.getString("path")));
|
ArrayList<String> paths = new ArrayList<>();
|
||||||
|
for (JsonObject jsonObject : otherOperations) {
|
||||||
|
paths.add(jsonObject.getString("path"));
|
||||||
|
}
|
||||||
|
for (String path : paths) {
|
||||||
|
if (path.matches("^[a-zA-Z]*$")) {
|
||||||
|
otherOperations.sort(Comparator.comparing(jsonObject -> jsonObject.getString("path")));
|
||||||
|
} else if (path.matches(".*\\d.*")) {
|
||||||
|
otherOperations.sort(
|
||||||
|
Comparator.comparing(
|
||||||
|
jsonObject -> {
|
||||||
|
String pathValue = jsonObject.getString("path");
|
||||||
|
String tagIndex = pathValue.replaceAll("\\D", "");
|
||||||
|
return tagIndex.isEmpty() ? 0 : Integer.parseInt(tagIndex);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!removeOperations.isEmpty()) {
|
if (!removeOperations.isEmpty()) {
|
||||||
removeOperations.sort(Comparator.comparing(jsonObject -> jsonObject.getString("path")));
|
ArrayList<String> paths = new ArrayList<>();
|
||||||
// reverse sort only the remove operations
|
for (JsonObject jsonObject : removeOperations) {
|
||||||
Collections.reverse(removeOperations);
|
paths.add(jsonObject.getString("path"));
|
||||||
|
}
|
||||||
|
for (String path : paths) {
|
||||||
|
if (path.matches("^[a-zA-Z]*$")) {
|
||||||
|
removeOperations.sort(Comparator.comparing(jsonObject -> jsonObject.getString("path")));
|
||||||
|
// reverse sort only the remove operations
|
||||||
|
Collections.reverse(removeOperations);
|
||||||
|
} else if (path.matches(".*\\d.*")) {
|
||||||
|
removeOperations.sort(
|
||||||
|
Comparator.comparing(
|
||||||
|
jsonObject -> {
|
||||||
|
String pathValue = jsonObject.getString("path");
|
||||||
|
String tagIndex = pathValue.replaceAll("\\D", "");
|
||||||
|
return tagIndex.isEmpty() ? 0 : Integer.parseInt(tagIndex);
|
||||||
|
}));
|
||||||
|
// reverse sort only the remove operations
|
||||||
|
Collections.reverse(removeOperations);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build new sorted patch
|
// Build new sorted patch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user