Skip to content

Commit 65c86c7

Browse files
committed
Fix labels and properties management
1 parent c4d9406 commit 65c86c7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

app/src/main/java/io/apicurio/registry/storage/importing/v2/SqlDataUpgrader.java

+13-4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ public void importArtifactVersion(ArtifactVersionEntity entity) {
103103
entity.globalId = storage.nextGlobalId();
104104
}
105105

106+
Map<String, String> artifactVersionLabels = new HashMap<>();
107+
108+
if (entity.labels != null) {
109+
artifactVersionLabels
110+
.putAll(entity.labels.stream().collect(Collectors.toMap(label -> label, s -> null)));
111+
}
112+
113+
if (entity.properties != null) {
114+
artifactVersionLabels.putAll(entity.properties);
115+
}
116+
106117
io.apicurio.registry.utils.impexp.v3.ArtifactVersionEntity newEntity = io.apicurio.registry.utils.impexp.v3.ArtifactVersionEntity
107118
.builder().createdOn(entity.createdOn).description(entity.description)
108119
.labels(entity.labels != null
@@ -118,10 +129,7 @@ public void importArtifactVersion(ArtifactVersionEntity entity) {
118129
if (entity.versionId == 1) {
119130
ArtifactEntity artifactEntity = ArtifactEntity.builder().artifactId(entity.artifactId)
120131
.artifactType(entity.artifactType).createdOn(entity.createdOn)
121-
.description(entity.description).groupId(entity.groupId)
122-
.labels(entity.labels != null
123-
? entity.labels.stream().collect(Collectors.toMap(label -> label, s -> null))
124-
: Collections.emptyMap())
132+
.description(entity.description).groupId(entity.groupId).labels(artifactVersionLabels)
125133
.modifiedBy(entity.createdBy).modifiedOn(entity.createdOn).name(entity.name)
126134
.owner(entity.createdBy).build();
127135
storage.importArtifact(artifactEntity);
@@ -295,6 +303,7 @@ private String determineContentType(String artifactTypeHint, TypedContent conten
295303
return ContentTypes.APPLICATION_GRAPHQL;
296304
case XML:
297305
case XSD:
306+
case WSDL:
298307
return ContentTypes.APPLICATION_XML;
299308
}
300309
}

0 commit comments

Comments
 (0)