fix: refines how defaults are shown

closes: #43421

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
Steven Hawkins 2025-10-21 08:35:55 -04:00 committed by GitHub
parent 419afce847
commit 4443834d06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View File

@ -17,9 +17,9 @@
</#macro>
<#macro list options buildIcon=true anchor=true categoryName="">
[cols="12a,4",role="options"]
[cols="12a,2,2",role="options"]
|===
| |Value
| |_Type_ or Values |Default
<#list options as option>
|
@ -53,9 +53,13 @@ ${option.deprecated.note!}<#if option.deprecated.newOptionsKeys?has_content><#if
</#if>
|<#if option.expectedValues?has_content>
<#list option.expectedValues as value>`+${value!}+`<#if option.defaultValue?has_content && value = option.defaultValue> (default)</#if><#if option.deprecated?has_content && option.deprecated.deprecatedValues?seq_contains(value)> (deprecated)</#if><#if value?has_next>, </#if></#list><#if !option.strictExpectedValues>, or any</#if>
<#list option.expectedValues as value>`+${value!}+`<#if option.deprecated?has_content && option.deprecated.deprecatedValues?seq_contains(value)> (deprecated)</#if><#if value?has_next>, </#if></#list><#if !option.strictExpectedValues>, or any</#if>
<#else>
<#if option.defaultValue?has_content>[.options-default]#`+${option.defaultValue!}+`# (default)</#if><#if option.type?has_content && option.defaultValue?has_content> or </#if><#if option.type?has_content && !option.expectedValues?has_content>any `+${option.type!}+`</#if>
_${option.type!}_
</#if>
|<#if option.defaultValue?has_content>
`+${option.defaultValue!}+`
</#if>
</#list>

View File

@ -46,9 +46,9 @@ public class Options {
.map(m -> new Option(m.getFrom(),
m.getCategory(),
m.isBuildTime(),
null,
m.getType().getSimpleName(),
m.getDescription(),
m.getDefaultValue().map(Object::toString).orElse(null),
m.getDefaultValue().orElse(null),
m.getExpectedValues(),
m.isStrictExpectedValues(),
m.getEnabledWhen().orElse(""),
@ -82,7 +82,7 @@ public class Options {
.map(m -> new Option(optionPrefix + toDashCase(m.getName()), OptionCategory.GENERAL, false,
m.getType(),
m.getHelpText(),
m.getDefaultValue() == null ? null : m.getDefaultValue().toString(),
m.getDefaultValue(),
m.getOptions() == null ? Collections.emptyList() : m.getOptions(),
true,
"",
@ -198,7 +198,7 @@ public class Options {
boolean build,
String type,
String description,
String defaultValue,
Object defaultValue,
Iterable<String> expectedValues,
boolean strictExpectedValues,
String enabledWhen,
@ -209,7 +209,7 @@ public class Options {
this.build = build;
this.type = type;
this.description = description;
this.defaultValue = defaultValue;
this.defaultValue = org.keycloak.config.Option.getDefaultValueString(defaultValue);
this.expectedValues = StreamSupport.stream(expectedValues.spliterator(), false).collect(Collectors.toList());
this.strictExpectedValues = strictExpectedValues;
this.enabledWhen = enabledWhen;