Skip to content

Commit

Permalink
fix: fix exporting HSD schemas for schemas with no namespace
Browse files Browse the repository at this point in the history
ING-4046
  • Loading branch information
stempler committed Oct 26, 2023
1 parent e27cc17 commit afafbe1
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,15 @@ public String getNamespace() {
public static Iterable<? extends Schema> merge(Iterable<? extends Schema> schemas,
boolean mergeAll) {
// count namespaces
Map<String, Long> counts = Streams.stream(schemas).map(schema -> schema.getNamespace())
.collect(Collectors.groupingBy(e -> e, Collectors.counting()));
Map<String, Long> counts = Streams.stream(schemas).map(schema -> {
String ns = schema.getNamespace();
if (ns == null) {
// replace null with empty string -> counting fails for null
// values
ns = "";
}
return ns;
}).collect(Collectors.groupingBy(e -> e, Collectors.counting()));

if (mergeAll) {
// we merge to one namespace
Expand All @@ -86,6 +93,9 @@ public static Iterable<? extends Schema> merge(Iterable<? extends Schema> schema
else {
namespace = DEFAULT_COMBINED_NAMESPACE;
}
if ("".equals(namespace)) {
namespace = null;
}

Schema schema = new MergedSchema(namespace, schemas);

Expand Down

0 comments on commit afafbe1

Please sign in to comment.