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

Override items from super classes when generating config documentation #41979

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -396,6 +396,19 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
configDocKey.setJavaDocSiteLink(getJavaDocSiteLink(type));
ConfigDocItem configDocItem = new ConfigDocItem();
configDocItem.setConfigDocKey(configDocKey);

// If there is already a config item with the same key it comes from a super type, and we need to override it
ConfigDocItem parent = null;
for (ConfigDocItem docItem : configDocItems) {
if (docItem.getConfigDocKey().getKey().equals(configDocKey.getKey())) {
parent = docItem;
break;
}
}
// We many want to merge the metadata, but let's keep this simple for now
radcortez marked this conversation as resolved.
Show resolved Hide resolved
if (parent != null) {
configDocItems.remove(parent);
}
configDocItems.add(configDocItem);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import java.util.Optional;
import java.util.OptionalInt;

import io.quarkus.runtime.annotations.ConfigGroup;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

@ConfigGroup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's not mandatory but I would say it's a good practice to keep the annotation, given the annotation processor is annotation driven.
They get discovered anyway when analyzing the config but this makes it discovered right away by the AP.

Copy link
Member Author

@radcortez radcortez Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this annotation is present in a super class relative to the mapping class, we do generate duplicate entries of the configuration, because we handle @ConfigGroup as a nested element and not as an inherited element.

We could also fix that in the code, but I think that super classes are not config groups, so it is a bit misleading to add that annotation.

public interface OtlpExporterConfig {
String DEFAULT_GRPC_BASE_URI = "http://localhost:4317/";
String DEFAULT_HTTP_BASE_URI = "http://localhost:4318/";
Expand Down
Loading