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

Tool to generate configuration reference docs #606

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

snazy
Copy link
Member

@snazy snazy commented Jan 2, 2025

Having documentation about the configuration that is both "up-to-date" and "in-sync with the source code" with the actual code is good practice.

The functionality added in this change allows generating markdown docs from smallrye-config based configuration types, starting at and grouped by types that are annotated with @ConfigMapping. The javadoc of the config interfaces and properties is emitted as markdown. On top there is functionality to generate reference docs for "static" types (currently unused in Polaris).

The code is nearly a 1:1 port of the same functionality in Nessie. This change will become useful with/after #469.

Gradle projects added in this change are:

  • polaris-config-doc-annotations adds an annotation used when generating docs to influence the generation of the configuration reference docs.
  • polaris-config-doc-generator is the reference doc generator implementation, as a "standalone" tool that uses javadoc infrastructure. See ReferenceConfigDocsGenerator why it needs to be a separate tool than "just" a doclet (class loader isolation issues).
  • polaris-site-reference-docs actually generates the markdown files from referenced Gradle projects. Currently there are no projects referenced, so generation yields nothing.

The generated docs are not yet integrated into the website, which will happen in a follow-up PR.

Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

+1 to adding this very useful tool... Just a couple of naming comments :)


polaris-ref-config-annotations=tools/ref-config/annotations
polaris-ref-config-generator=tools/ref-config/generator
polaris-ref-config-site=tools/ref-config/site
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: IMHO the name ref-config looks a bit awkward... How about tools/config-doc?


import java.time.Duration;

public interface IntOne extends IntTwo {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: IntOne makes me think of integer 1 :) Maybe InterfaceOne?

snazy added 2 commits January 13, 2025 21:16
Having documentation about the configuration that is both "up-to-date" and "in-sync with the source code" with the actual code is good practice.

The functionality added in this change allows generating markdown docs from smallrye-config based configuration types, starting at and grouped by types that are annotated with `@ConfigMapping`. The javadoc of the config interfaces and properties is emitted as markdown. On top there is functionality to generate reference docs for "static" types (currently unused in Polaris).

The code is nearly a 1:1 port of the same functionality in Nessie. This change will become useful with/after apache#469.

Gradle projects added in this change are:
* `polaris-config-doc-annotations` adds an annotation used when generating docs to influence the generation of the configuration reference docs.
* `polaris-config-doc-generator` is the reference doc generator implementation, as a "standalone" tool that uses javadoc _infrastructure_. See `ReferenceConfigDocsGenerator` why it needs to be a separate tool than "just" a doclet (class loader isolation issues).
* `polaris-site-reference-docs` actually generates the markdown files from referenced Gradle projects. Currently there are no projects referenced, so generation yields nothing.

The generated docs are not yet integrated into the website, which will happen in a follow-up PR.
@snazy snazy enabled auto-merge (squash) January 13, 2025 20:23
@snazy snazy merged commit 8207f63 into apache:main Jan 13, 2025
5 checks passed
@snazy snazy deleted the cfg-ref-doc-gen branch January 13, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants