Skip to content

Commit

Permalink
Config Doc - Use enum tooltip also for default value
Browse files Browse the repository at this point in the history
This is an improvement over what we had.
Fixes quarkusio#42374
  • Loading branch information
gsmet authored and danielsoro committed Sep 20, 2024
1 parent a22271a commit bb0f040
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ String formatTypeDescription(ConfigProperty configProperty) {
String formatDefaultValue(ConfigProperty configProperty) {
String defaultValue = configProperty.getDefaultValue();

if (defaultValue == null) {
return null;
}

if (configProperty.isEnum()) {
Optional<String> enumConstant = configProperty.getEnumAcceptedValues().values().entrySet().stream()
.filter(e -> e.getValue().configValue().equals(defaultValue))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,12 @@ private static Engine initializeQuteEngine(AsciidocFormatter asciidocFormatter)
.applyToNoParameters()
.resolveSync(ctx -> asciidocFormatter.formatDescription((ConfigProperty) ctx.getBase()))
.build())
.addValueResolver(ValueResolver.builder()
.applyToBaseClass(ConfigProperty.class)
.applyToName("formatDefaultValue")
.applyToNoParameters()
.resolveSync(ctx -> asciidocFormatter.formatDefaultValue((ConfigProperty) ctx.getBase()))
.build())
.addValueResolver(ValueResolver.builder()
.applyToBaseClass(ConfigSection.class)
.applyToName("formatTitle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ a|{#if configProperty.phase.fixedAtBuildTime}icon:lock[title=Fixed at build time
{#envVar configProperty /}
--
{#if configProperty.enum}a{/if}|{configProperty.formatTypeDescription.escapeCellContent.or("")}
|{#if configProperty.defaultValue}`{configProperty.defaultValue.escapeCellContent}`{#else if !configProperty.optional}required icon:exclamation-circle[title=Configuration property is required]{/if}
|{#if configProperty.defaultValue}{configProperty.formatDefaultValue.escapeCellContent}{#else if !configProperty.optional}required icon:exclamation-circle[title=Configuration property is required]{/if}

0 comments on commit bb0f040

Please sign in to comment.