Skip to content

MINIFICPP-2712 Generate modular docs#2097

Open
martinzink wants to merge 5 commits intoapache:mainfrom
martinzink:generate_modular_docs
Open

MINIFICPP-2712 Generate modular docs#2097
martinzink wants to merge 5 commits intoapache:mainfrom
martinzink:generate_modular_docs

Conversation

@martinzink
Copy link
Member

@martinzink martinzink commented Feb 6, 2026

With this PR, ./minifi --docs <output_dir> will generate additional md files one per extension <output_dir>/modules


Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.

@martinzink martinzink added the low-impact Test only or trivial change that's most likely not gonna introduce any new bugs label Feb 6, 2026
@martinzink martinzink requested a review from Copilot February 6, 2026 12:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the documentation generation code to support modular documentation in addition to the existing monolithic documentation. The refactoring moves procedural code into two classes (MonolithDocumentation and ModularDocumentation) to better separate concerns and introduce the new modular documentation feature.

Changes:

  • Refactored documentation generation from procedural to class-based approach with MonolithDocumentation and ModularDocumentation classes
  • Added support for generating per-module documentation files in a modules/ subdirectory
  • Applied code formatting improvements (brace placement, range-based for loop spacing) to comply with .clang-format settings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martinzink martinzink added this to the Rust bindings milestone Feb 12, 2026
martinzink added a commit that referenced this pull request Feb 12, 2026
With this PR, ./minifi --docs <output_dir> will generate additional md files one per extension <output_dir>/modules

Closes #2097

Signed-off-by: Martin Zink <martinzink@apache.org>
martinzink added a commit that referenced this pull request Feb 12, 2026
With this PR, ./minifi --docs <output_dir> will generate additional md files one per extension <output_dir>/modules

Closes #2097

Signed-off-by: Martin Zink <martinzink@apache.org>

docs << "\n\n## Table of Contents\n\n";
for (const auto& [name, documentation] : class_descriptions) {
for (const auto& [name, documentation]: class_descriptions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove the spaces before the colons (here and at several other places in this file)? The Google style guide recommends a space before and after the colon: https://google.github.io/styleguide/cppguide.html#Horizontal_Whitespace, and that's what we have in at least 90% of minifi code, as well. Please put them back.

Copy link
Member Author

@martinzink martinzink Mar 6, 2026

Choose a reason for hiding this comment

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

I've just auto formated the file, it seems like our clang-format didnt agree with our stated style guide
I've modified that aswell fix clang-format

class MonolithDocumentation {
public:
explicit MonolithDocumentation() {
for (const auto& [bundle_id, component]: minifi::ClassDescriptionRegistry::getClassDescriptions()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The second variable has type minifi::Components. Why did you rename it from components to component? Please revert this.

Copy link
Member Author

Choose a reason for hiding this comment

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

class ModularDocumentation {
public:
static void write(const std::filesystem::path& docs_dir) {
for (auto& [bundle_id, component]: minifi::ClassDescriptionRegistry::getMutableClassDescriptions()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this have to be mutable?

Copy link
Member Author

Choose a reason for hiding this comment

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

if we want to sort them yeah, I agree it might not be nicest but either this or we copy them into another struct or copy them in the loop?

class ModularDocumentation {
public:
static void write(const std::filesystem::path& docs_dir) {
for (auto& [bundle_id, component]: minifi::ClassDescriptionRegistry::getMutableClassDescriptions()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would name this components, as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +267 to +269
std::ranges::sort(components.processors, {}, &minifi::ClassDescription::short_name_);
std::ranges::sort(components.controller_services, {}, &minifi::ClassDescription::short_name_);
std::ranges::sort(components.parameter_providers, {}, &minifi::ClassDescription::short_name_);
Copy link
Contributor

Choose a reason for hiding this comment

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

This would put PutSQL before PutSmb, for example. I don't know if we currently have two such names within one module, but we might in the future. I would prefer a case-insensitive sort, unless you have a good reason to prefer this case-sensitive one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

low-impact Test only or trivial change that's most likely not gonna introduce any new bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants