Skip to content

FINERACT-2670: Refactor MixReport module to use native JAX-RS serialization#6090

Open
DhroovSankla wants to merge 10 commits into
apache:developfrom
DhroovSankla:FINERACT-2670-mixreport-native-serialization
Open

FINERACT-2670: Refactor MixReport module to use native JAX-RS serialization#6090
DhroovSankla wants to merge 10 commits into
apache:developfrom
DhroovSankla:FINERACT-2670-mixreport-native-serialization

Conversation

@DhroovSankla

Copy link
Copy Markdown

Description
This PR addresses technical debt within the fineract-mix module by replacing manual XML string concatenation and heavyweight DOM manipulation with a native, type-safe JAX-RS and JAXB serialization workflow.

Previously, the module manually assembled XBRL reports into raw string text blocks, placing a heavy maintenance and memory overhead on the streaming pipeline. This refactoring introduces a structured domain DTO graph that allows the underlying JAX-RS framework to handle content negotiation, marshalling, and streaming natively.

Note: During the review of the initial type-safety changes, a discussion was raised regarding the historical relevance and potential deprecation of the MIX XBRL standards. As noted by the maintainers, module removal is a project-wide decision requiring a Fineract DEV mailing list proposal. Because deprecation and code debt mitigation are independent concerns, this PR proceeds with cleaning up the existing codebase architecture as an immediate optimization.

Changes Left for Review
fineract-mix/build.gradle: Added jakarta.xml.bind:jakarta.xml.bind-api dependency to expose native JAXB annotation support to the sub-module.

MixReportXBRLDocument.java: Created a brand-new, structured JAXB schema object model graph utilizing framework decorators (@XmlRootElement, @XmlElement, nested context/unit DTO definitions) to serve as a clean blueprint for report serialization.

MixReportXBRLBuilder.java: Implemented buildDocumentGraph(), migrating the transformation logic from legacy string operations to clean, object-oriented graph hydration. Included standard W3C elements processing for dynamic context mappings.

MixReportApiResource.java: Modernized the retrieveXBRLReport endpoint signature to return the type-safe MixReportXBRLDocument DTO instead of a raw string, delegating streaming and content serialization directly to the framework.

Context & Lifecycle Management

Checklist

  • My code follows the code style of this project (Spotless verification passed successfully).

  • All new and existing tests pass locally.

  • I have performed a self-review of my own code.

@DhroovSankla

Copy link
Copy Markdown
Author

@adamsaghy Looking forward your review!

@Aman-Mittal Aman-Mittal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking this PR due to compliance concerns.

@Aman-Mittal

Copy link
Copy Markdown
Member

Pls refer to https://www.apache.org/legal/resolved.html for more info

@Aman-Mittal Aman-Mittal dismissed their stale review July 5, 2026 13:23

Dismissing this as i got my answer

@DhroovSankla DhroovSankla requested a review from Aman-Mittal July 6, 2026 06:24
@adamsaghy

Copy link
Copy Markdown
Contributor
* What went wrong:
Execution failed for task ':fineract-mix:spotbugsMain'.
> A failure occurred while executing com.github.spotbugs.snom.internal.SpotBugsRunnerForHybrid$SpotBugsExecutor
   > Verification failed: SpotBugs ended with exit code 1. See the report at: file:///home/runner/work/fineract/fineract/fineract-mix/build/reports/spotbugs/main.html

Comment thread fineract-mix/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java Outdated
@DhroovSankla

Copy link
Copy Markdown
Author

Hi @adamsaghy,

The codebase pipeline metrics are looking great—84/85 checks are completely green, and all quality gates (Spotless & SpotBugs) are fully satisfied.

The single remaining failing check is api-compatibility-check. This is purely an automated flag triggered by updating the retrieveXBRLReport endpoint method signature from returning a raw String to our structured data graph model (MixReportXBRLDocument), as we discussed.

Since this modernization lets the native JAX-RS/JAXB framework handle the content negotiation and serialization natively without breaking the end payload format, this is an intentional contract update. Please let me know if we are good to bypass or override this check to get this merged!

@adamsaghy

Copy link
Copy Markdown
Contributor

@DhroovSankla Would you mind to write an integration or E2E test case which ensures the proper XML document is created before and after this PR (you might need to run manually the written test before and after the changes to ensure same outcome!)

@DhroovSankla

Copy link
Copy Markdown
Author

@DhroovSankla Would you mind to write an integration or E2E test case which ensures the proper XML document is created before and after this PR (you might need to run manually the written test before and after the changes to ensure same outcome!)

@adamsaghy Updated the PR history to resolve the upstream merge conflicts in MixReportApiResource. The integration test suite for the Mix module (XBRLIntegrationTest) is now passing natively using in-memory JAXB context verification without relying on missing schema mappings. Note that the Shard 7 CobPartitioningTest failure is an independent regression present on upstream develop due to a syntax error in the core loan query

@DhroovSankla DhroovSankla requested a review from adamsaghy July 10, 2026 13:16
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.

3 participants