Skip to content

Commit

Permalink
Config Doc - Add more information to config metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Sep 5, 2024
1 parent 95767f0 commit 7df1e97
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import io.quarkus.annotation.processor.documentation.config.model.Extension;
import io.quarkus.annotation.processor.documentation.config.model.Extension.NameSource;
import io.quarkus.annotation.processor.documentation.config.model.JavadocElements.JavadocElement;
import io.quarkus.annotation.processor.documentation.config.model.SourceType;
import io.quarkus.annotation.processor.documentation.config.util.JacksonMappers;
import io.quarkus.maven.extension.deployment.metadata.model.spring.QuarkusConfigAdditionalMetadataProperty;
import io.quarkus.maven.extension.deployment.metadata.model.spring.QuarkusConfigAdditionalMetadataProperty.ConfigPhase;
Expand Down Expand Up @@ -106,7 +107,10 @@ public void visit(AbstractConfigItem configItem) {
if (configItem instanceof ConfigProperty configProperty) {
// TODO: we will need to add more metadata on our side
SpringConfigMetadataDeprecation deprecation = configProperty.isDeprecated()
? new SpringConfigMetadataDeprecation("warning", "", "", "")
? new SpringConfigMetadataDeprecation("warning",
configProperty.getDeprecation().reason(),
configProperty.getDeprecation().replacement(),
configProperty.getDeprecation().since())
: null;

// TODO: be careful, this is asciidoc, we will discuss this further with the IDE teams
Expand All @@ -118,8 +122,11 @@ public void visit(AbstractConfigItem configItem) {
ConfigPhase phase = ConfigPhase.of(configProperty.getPhase());

properties.add(new SpringConfigMetadataProperty(configProperty.getPath().property(),
configProperty.getType(),
description, configProperty.getSourceClass(), configProperty.getDefaultValue(),
configProperty.getType(), description,
configProperty.getSourceClass(),
configProperty.getSourceType() == SourceType.FIELD ? configProperty.getSourceName() : null,
configProperty.getSourceType() == SourceType.METHOD ? configProperty.getSourceName() : null,
configProperty.getDefaultValue(),
deprecation, new QuarkusConfigAdditionalMetadataProperty(phase,
configProperty.getPath().environmentVariable(), configProperty.isOptional())));
if (configProperty.isEnum()) {
Expand All @@ -134,7 +141,14 @@ deprecation, new QuarkusConfigAdditionalMetadataProperty(phase,
for (PropertyPath additionalPath : configProperty.getAdditionalPaths()) {
properties.add(
new SpringConfigMetadataProperty(additionalPath.property(), configProperty.getType(),
description, configProperty.getSourceClass(), configProperty.getDefaultValue(),
description, configProperty.getSourceClass(),
configProperty.getSourceType() == SourceType.FIELD
? configProperty.getSourceName()
: null,
configProperty.getSourceType() == SourceType.METHOD
? configProperty.getSourceName()
: null,
configProperty.getDefaultValue(),
deprecation, new QuarkusConfigAdditionalMetadataProperty(phase,
additionalPath.environmentVariable(), configProperty.isOptional())));
if (configProperty.isEnum()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package io.quarkus.maven.extension.deployment.metadata.model.spring;

public record SpringConfigMetadataProperty(String name, String type, String description, String sourceType, String defaultValue,
public record SpringConfigMetadataProperty(String name, String type, String description,
String sourceType,
// these two are not in the Spring format but were explicitly requested
String sourceField, String sourceMethod, String defaultValue,
SpringConfigMetadataDeprecation deprecation, QuarkusConfigAdditionalMetadataProperty quarkus) {

}

0 comments on commit 7df1e97

Please sign in to comment.