Skip to content

Commit

Permalink
Merge pull request quarkusio#40202 from phillip-kruger/dev-ui-cast
Browse files Browse the repository at this point in the history
Fix List/String reading from yaml in Dev UI
  • Loading branch information
phillip-kruger authored Apr 23, 2024
2 parents 1f81f41 + 8f9621a commit 6937024
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void getAllExtensions(List<CardPageBuildItem> cardPageBuildItems,
if (codestartMap != null) {
Codestart codestart = new Codestart();
codestart.setName((String) codestartMap.getOrDefault(NAME, null));
codestart.setLanguages((List<String>) codestartMap.getOrDefault(LANGUAGES, null));
codestart.setLanguages(listOrString(codestartMap, LANGUAGES));
codestart.setArtifact((String) codestartMap.getOrDefault(ARTIFACT, null));
extension.setCodestart(codestart);
}
Expand Down Expand Up @@ -594,6 +594,18 @@ private String collectionToString(Map<String, Object> metaData, String key) {
return String.valueOf(value);
}

private List<String> listOrString(Map<String, Object> metaData, String key) {
Object value = metaData.getOrDefault(key, null);
if (value == null) {
return null;
} else if (String.class.isAssignableFrom(value.getClass())) {
return List.of((String) value);
} else if (List.class.isAssignableFrom(value.getClass())) {
return (List) value;
}
return List.of(String.valueOf(value));
}

private void produceResources(String artifactId,
BuildProducer<WebJarBuildItem> webJarBuildProducer,
BuildProducer<DevUIWebJarBuildItem> devUIWebJarProducer) {
Expand Down

0 comments on commit 6937024

Please sign in to comment.