Skip to content

Commit

Permalink
Merge pull request #760 from hivemq/fix/simulation-issue
Browse files Browse the repository at this point in the history
FIxed a bug where null-values resulted in nonrenderable json
  • Loading branch information
codepitbull authored Jan 24, 2025
2 parents 9e41eb0 + 3aaca2d commit b4f11ee
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public class DomainTag {

private final @NotNull String tagName;
private final @NotNull String adapterId;
private final @NotNull String description;
private final @Nullable String description;
private final @NotNull JsonNode definition;

public DomainTag(
final @NotNull String tagName,
final @NotNull String adapterId,
final @NotNull String description,
final @Nullable String description,
final @NotNull JsonNode definition) {
this.tagName = tagName;
this.adapterId = adapterId;
Expand All @@ -46,7 +46,8 @@ public DomainTag(
final @NotNull com.hivemq.edge.api.model.DomainTag domainTag,
final @NotNull String adapterId,
final @NotNull ObjectMapper objectMapper) {
return new DomainTag(domainTag.getName(),
return new DomainTag(
domainTag.getName(),
adapterId,
domainTag.getDescription(),
objectMapper.valueToTree(domainTag.getDefinition()));
Expand Down Expand Up @@ -75,7 +76,7 @@ public DomainTag(
}

public @NotNull Map<String, Object> toTagMap() {
return Map.of("name", tagName, "description", description, "definition", definition);
return Map.of("name", tagName, "description", description != null ? description : "", "definition", definition);
}

// only tag is used as duplicates based on this field are not allowed.
Expand Down

0 comments on commit b4f11ee

Please sign in to comment.