FINERACT-2703: Validate required datatables based on legal form during client creation - #6172
Open
Samer-Melhem-FOO wants to merge 2 commits into
Open
Conversation
…g client creation
Restore uppercasing of the legal-form-derived entity subtype before matching it against RegisteredDatatable.subtype, which is stored uppercase by convention (e.g. "PERSON"/"ENTITY"). The prior commit dropped this normalization in EntityDatatableChecksWritePlatformServiceImpl, causing required-datatable checks to silently never match and the EntityDatatableChecksIntegrationTest#validateCreateClientWithEntityDatatableCheckWithFailure CI test to fail (expected 403, got 200). Apply the same normalization in the new ClientDataValidator.resolveEntitySubtype so the added legal-form validation works against real data, not just mocks.
Contributor
Author
|
The only failing check here is This is a transient Docker Hub registry connectivity issue on the runner, unrelated to this PR's change. All 14/15 other MySQL shards, all MariaDB/PostgreSQL shards, and every other check passed. Could a maintainer re-run the failed job? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PersonorEntity), client creation for the other sub-type incorrectly failed with "Datatable cannot be empty", even though no datatable check actually applies to that sub-type.EntityDatatableChecksWritePlatformServiceImpl.runTheCheck(...)upper-cased theentitySubtypebefore looking it up (entitySubtype.toUpperCase()), but the value is stored verbatim (e.g."Person","Entity", matchingLegalForm.getLabel()), so the lookup could silently return nothing.ClientDataValidator.validateForCreate(...)unconditionally required thedatatablesJSON array to be non-empty whenever thedatatablesparameter was present in the request, regardless of whether any datatable check actually applies to the submitted legal form..toUpperCase(), and addedareDatatablesRequiredForLegalForm(...)so the non-emptydatatablescheck is only enforced when at least oneEntityDatatableChecksrecord is actually configured for the client's legal-form subtype (or globally, when no subtype is set).Test plan
ClientDataValidatorTestwith 2 new tests:validateForCreate_withEmptyDatatables_whenNoneRequiredForLegalForm_doesNotThrowvalidateForCreate_withEmptyDatatables_whenRequiredForLegalForm_throwsPlatformApiDataValidationExceptionClientDataValidatorTestpass./gradlew :fineract-provider:compileJava :fineract-provider:compileTestJava— builds clean./gradlew :fineract-provider:spotlessApply— no formatting drift beyond this changePerson-only required datatable, create anEntityclient without datatables, confirm it now succeedshttps://issues.apache.org/jira/browse/FINERACT-2703