Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added missing string to object mapper #22

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public ThemeSnapshotDTOV1 create(Map<String, Theme> data) {

public abstract Map<String, EximThemeDTOV1> map(Map<String, Theme> data);

@Mapping(target = "properties", qualifiedByName = "propertiesJson")
public abstract EximThemeDTOV1 map(Theme theme);

@Mapping(target = "id", ignore = true)
Expand Down Expand Up @@ -81,4 +82,18 @@ public String mapToString(Object properties) {
return null;
}
}

@Named("propertiesJson")
public Object stringToObject(String jsonVar) {

if (jsonVar == null || jsonVar.isEmpty()) {
return null;
}

try {
return objectMapper.readTree(jsonVar);
} catch (JsonProcessingException e) {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public ThemeInfoListDTO mapInfoList(Stream<ThemeInfo> data) {
public abstract List<ThemeDTO> map(Stream<Theme> entity);

@Mapping(target = "version", source = "modificationCount")
@Mapping(target = "properties", qualifiedByName = "propertiesJson")
public abstract ThemeDTO map(Theme theme);

@Mapping(target = "id", ignore = true)
Expand Down Expand Up @@ -86,4 +87,18 @@ public String mapToString(Object properties) {
}
}

@Named("propertiesJson")
public Object stringToObject(String jsonVar) {

if (jsonVar == null || jsonVar.isEmpty()) {
return null;
}

try {
return mapper.readTree(jsonVar);
} catch (JsonProcessingException e) {
return null;
}
}

}
Loading