FINERACT-1556: treat template runreports as parameter metadata#5606
Open
Satish11012007 wants to merge 1 commit intoapache:developfrom
Open
FINERACT-1556: treat template runreports as parameter metadata#5606Satish11012007 wants to merge 1 commit intoapache:developfrom
Satish11012007 wants to merge 1 commit intoapache:developfrom
Conversation
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.
Description
This PR fixes an issue where calling the Stretchy Reports endpoint with
template=truestill attempted to execute the underlying SQL query.Stretchy report queries often contain placeholders such as
${officeId}{}or${currencyId}{}which are meant to be replaced with request parameters. Whentemplate=trueis used, the expected behavior is to return report parameter metadata without executing the SQL query.However, the existing implementation did not properly handle the
templateflag. As a result, the SQL query was executed with unresolved placeholders, which caused PostgreSQL to throw errors such as:org.postgresql.util.PSQLException: ERROR: syntax error at or near "$"
This PR resolves the issue by ensuring that when
template=trueis present in the request andparameterTypeis not explicitly provided, the system automatically treats the request as a parameter metadata request by settingparameterType=true.This prevents SQL execution and returns the required report parameter metadata as intended.
Fixes: FINERACT-1556
Changes Made
RunreportsApiResource.processReportRequestto ensure thattemplate=trueimpliesparameterType=truewhenparameterTypeis not explicitly provided.templateflag.Files Modified
Testing
Added unit tests to verify that requests with
template=truecorrectly propagate asparameterType=true.Commands used:
./gradlew :fineract-provider:test --tests org.apache.fineract.infrastructure.dataqueries.api.RunreportsApiResourceTest
./gradlew :fineract-provider:test
Result:
All tests passed successfully.
How to Verify
Call the following API:
GET /fineract-provider/api/v1/runreports/Active%20Loans%20-%20Details?template=true
Expected behavior:
$placeholder errors occurChecklist