Add API to get diagnostice for query clause#661
Merged
KavinduZoysa merged 2 commits intoballerina-platform:mainfrom Feb 2, 2026
Merged
Add API to get diagnostice for query clause#661KavinduZoysa merged 2 commits intoballerina-platform:mainfrom
KavinduZoysa merged 2 commits intoballerina-platform:mainfrom
Conversation
9f2d81f to
8421de2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new API to get diagnostics for query clauses in the data mapper feature. The implementation allows validating query clauses (such as where clauses) before they are applied, providing early feedback on syntax and type errors.
Changes:
- Added new
clauseDiagnosticsAPI endpoint in DataMapperService to retrieve diagnostics for data mapper query clauses - Implemented diagnostic validation logic in DataMapManager that creates a temporary modified document and retrieves semantic model diagnostics
- Added comprehensive test coverage with DataMappingClauseValidationTest and test resources
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| testng.xml | Added new test class DataMappingClauseValidationTest to test suite |
| variable1.bal | Test source file with sample query expression for clause validation testing |
| variable1.json | Test configuration for validating a new clause with type incompatibility error |
| variable2.json | Test configuration for validating an existing clause with undefined symbol error |
| DataMappingClauseValidationTest.java | New test class to validate clause diagnostics API functionality |
| DataMapperClauseDiagnosticsResponse.java | Response model for clause diagnostics API |
| DataMapperClauseDiagnosticsRequest.java | Request model containing clause validation parameters |
| DataMapperService.java | Added clauseDiagnostics endpoint that processes validation requests |
| DataMapManager.java | Implemented getClauseDiagnostics method that applies clause modifications and retrieves diagnostics |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...src/test/java/io/ballerina/flowmodelgenerator/extension/DataMappingClauseValidationTest.java
Outdated
Show resolved
Hide resolved
...src/test/java/io/ballerina/flowmodelgenerator/extension/DataMappingClauseValidationTest.java
Outdated
Show resolved
Hide resolved
...src/test/java/io/ballerina/flowmodelgenerator/extension/DataMappingClauseValidationTest.java
Show resolved
Hide resolved
.../io/ballerina/flowmodelgenerator/extension/response/DataMapperClauseDiagnosticsResponse.java
Outdated
Show resolved
Hide resolved
.../io/ballerina/flowmodelgenerator/extension/response/DataMapperClauseDiagnosticsResponse.java
Outdated
Show resolved
Hide resolved
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Show resolved
Hide resolved
...src/test/java/io/ballerina/flowmodelgenerator/extension/DataMappingClauseValidationTest.java
Outdated
Show resolved
Hide resolved
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Outdated
Show resolved
Hide resolved
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Show resolved
Hide resolved
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Outdated
Show resolved
Hide resolved
8421de2 to
30b889f
Compare
gimantha
previously approved these changes
Jan 28, 2026
...-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/DataMapManager.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| TextDocument newTextDocument = textDocument.apply( | ||
| TextDocumentChange.from(List.of(io.ballerina.tools.text.TextEdit.from(textRange, clauseStr)) |
Contributor
There was a problem hiding this comment.
Shall we remove the absolute reference for TextEdit here and use it after import
Contributor
Author
There was a problem hiding this comment.
Since we have used org.eclipse.lsp4j.TextEdit, this should be an absolute reference.
30b889f to
b54c639
Compare
gimantha
approved these changes
Feb 2, 2026
gimantha
approved these changes
Feb 2, 2026
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.
Purpose
Addresses wso2/product-ballerina-integrator#2322