[docs][build] Generate config options docs automatically from `ConfigOptions`
Search before asking
- [x] I searched in the issues and found nothing similar.
Motivation
Adding or altering configuration options is currently a manual 2-step process.
- Add/alter config option in the source code (
com.alibaba.fluss.config.ConfigOptions) - Add/alter config option in the docs
With a growing code base and more developers joining, this approach becomes errorprone. Extracting the config options from the source code would automatically keep the docs in sync.
Solution
~1. Evaluate if there is an existing Maven plugin that can be used 2. If 1. is "no", build a small custom Maven plugin~
Take inspiration from Flinks doc generation module and check if adaptions are needed.
Anything else?
No response
Willingness to contribute
- [x] I'm willing to submit a PR!
@michaelkoepf, you could follow the way how Flink generates the document of config options to generate document automatically for fluss.
+1 for this, are you willing to contribute this @michaelkoepf ?
@wuchong yes, i'll take the issue
Hi @michaelkoepf , are you still interested in contributing to this issue? I think we can break it down into several subtasks. For example, we could start by implementing ConfigOptionsDocGenerator to convert ConfigOptions into HTML, then add support for scripting, and finally support inserting the HTML into .md files.
@wuchong yes, just a bit short on time at the moment. we can split it up into multiple sub-issues.
"Hi @Giannis Polyzos, @wuchong I've seen how Flink handles this with their flink-docs module, and I'd love to help implement something similar for Fluss to keep the ConfigOptions and documentation in sync.
I'll start by looking at the current ConfigOptions in Fluss and how Flink's documentation generator is structured. I'm definitely interested in taking this on issue
@Prajwal-banakar Thank you for your interest... Assigned to you!
"Hi @polyzos Polyzos, I’ve spent some time researching how Flink handles this. I'd like to discuss the high-level plan before I start coding:
Module Structure: I'm thinking of creating a fluss-docs module to house the generator logic. Does that align with our project structure? Approach: I plan to follow the Flink model using Reflection to scan ConfigOptions classes. However, I noticed Flink uses a custom annotation processor for some docs—should we start with simple Reflection first? Execution: Should this tool be integrated as a Maven plugin that runs during the build, or a standalone utility for now?
I’d love to hear your thoughts on this so I can draft a small design doc or move straight to a prototype.
Hi @Prajwal-banakar , thanks for taking this issue. This would be a huge contribution to the community.
Quick answers:
- Module: I suggest
fluss-docgen(as we already havefluss-protogenand will introducefluss-codegensoon). Thefluss-docssounds like it places doc markdown files in it, but not. - Approach: The annotation is used to identify the category/section the config belongs to. So I think we may need annotations or adding variables to the
ConfigOptionclass. - Execution: +1 for maven plugin.
- Display: I think table format is hard to display more content, and not compact. I suggest to use list format with default values and types are labeled after the config key. A good example: https://docs.restate.dev/references/server-config#param-log-filter
Besides, Kafka also has config doc generation framework:
- https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java
- https://kafka.apache.org/41/configuration/broker-configs/#updating-ssl-keystore-of-an-existing-listener
Hi @wuchong , I've just submitted a PR to address this. I followed the reflection-based approach and used the list format as suggested. Looking forward to your feedback!