-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fineract 2316 localize interest rate chart validation #5038
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
base: develop
Are you sure you want to change the base?
Fineract 2316 localize interest rate chart validation #5038
Conversation
|
|
@sidshas03 one check is failing, could you please check? |
- Add proper Apache license headers to messages.properties and messages_de.properties - Fixes Apache RAT license audit failure - Resolves CI check failure for PR apache#5038
|
@adamsaghy could you please help in review of this PR? |
|
@sidshas03 are you still working on this PR? |
|
@sidshas03 Please rebase this PR with latest |
|
@sidshas03 Are you still working on this? -> Please rebase this PR with latest develop branch! |
Yes @adamsaghy I am working on it right now |
…args); add tests; fix CI - Replace hard-coded error messages with message codes in InterestRateChart.java - Use failWithCode method instead of failWithCodeNoParameterAddedToErrorCode - Add message keys to fineract-provider/src/main/resources/messages.properties - Add German translations in messages_de.properties - Create unit tests for overlap and gap validation error codes and arguments - Update tests to assert both error codes and arguments properly - All quality checks pass (spotless, checkstyle, spotbugs, tests) This supersedes PR apache#4793 and provides proper internationalization support for interest rate chart validation error messages without domain layer coupling.
…l keys - Switch from failWithCode to failWithCodeNoParameterAddedToErrorCode for proper error code generation - Update tests to expect correct error codes without 'null' parameter - Error codes now properly resolve to: - validation.msg.interestRateChart.validation.msg.savings.interestRateChart.slabs.overlap - validation.msg.interestRateChart.validation.msg.savings.interestRateChart.slabs.gap - All quality checks pass (spotless, checkstyle, spotbugs, tests)
…efix) - Use direct ApiParameterError creation for overlap/gap validations - Avoid double-prefixed error codes by bypassing DataValidatorBuilder - Error codes now resolve to clean format: - validation.msg.savings.interestRateChart.slabs.overlap - validation.msg.savings.interestRateChart.slabs.gap - Remove hard-coded error messages, let i18n system handle them - All quality checks pass (spotless, checkstyle, spotbugs, tests)
…ith short keys for overlap/gap
- Replace direct ApiParameterError creation with DataValidatorBuilder approach
- Use resource('savings.interestRateChart') and parameter('slabs') context
- Short keys: 'overlap' and 'gap' instead of full validation.msg.* keys
- Error codes now resolve to: validation.msg.savings.interestRateChart.slabs.overlap/gap
- Update tests to use same DataValidatorBuilder pattern
- All quality checks pass (spotless, checkstyle, spotbugs, tests)
- Add proper Apache license headers to messages.properties and messages_de.properties - Fixes Apache RAT license audit failure - Resolves CI check failure for PR apache#5038
9d2296b to
deeff92
Compare
|
@sidshas03 Please rebase and squash your commits. |
Summary
This PR completes the i18n work for InterestRateChart slab validation and gets CI to green. Hard-coded/concatenated messages are replaced with message codes + arguments, message bundles are updated, focused tests cover overlap and gap scenarios, and
spotless/checkstyle/spotbugs/testspass locally.Supersedes #4793 (credit to the original author and discussion).
What changed (final approach adopted)
Domain stays Spring-free; standard validator pattern used
Resolves to clean codes:
validation.msg.savings.interestRateChart.slabs.overlapvalidation.msg.savings.interestRateChart.slabs.gapMessage bundles (added/updated in
fineract-provider/src/main/resources/messages.properties)Tests
Added/updated unit tests to trigger overlap/gap and assert the exact codes (and arguments where exposed).
CI
Ran
spotless,checkstyle,spotbugs, and tests locally — all green.Alternatives evaluated and not taken (with reasons)
MessageSource/LocaleContextHolderinto domain/assemblers — rejected to keep the domain layer clean; Fineract typically passes codes + args and resolves messages later.InterestRateChartDataValidatorBuildersubclass — rejected to avoid expanding API surface; standard builder suffices.resource()/parameter()set — led to double-prefixed codes (e.g.,validation.msg.interestRateChart.validation.msg.savings…).failWithCodeNoParameterAddedToErrorCodeon a builder with context — could still introduce unwanted prefixes ornullsegments based on builder state.ApiParameterError.parameterError(...)— functional but bypasses the usual validator aggregation flow; reverted for consistency.Scope (files of interest)
fineract-savings/src/main/java/.../InterestRateChart.javafineract-provider/src/main/resources/messages.properties(and optional locale bundles)fineract-savings/src/test/java/.../InterestRateChartValidationTest.javaCompatibility / API notes
globalisationMessageCodefor these validations now follows the standardvalidation.msg.savings.interestRateChart.*pattern.How to verify
Build & checks:
./gradlew spotlessApply checkstyleMain checkstyleTest spotbugsMain spotbugsTest testConfirm no hard-coded “overlap/gap” texts remain in
InterestRateChart.java.Run the updated tests; assertions should pass for the two codes above.
Housekeeping
@bharathcgowda - following up from #4793.
I’ve opened this PR to localise the InterestRateChart slab validation using the minimal approach we discussed. Thank you so much for allowing me to work on it. Please kindly review and let me know.