Skip to content

Comments

Add API to get diagnostice for query clause#661

Merged
KavinduZoysa merged 2 commits intoballerina-platform:mainfrom
KavinduZoysa:fix-issue-2322
Feb 2, 2026
Merged

Add API to get diagnostice for query clause#661
KavinduZoysa merged 2 commits intoballerina-platform:mainfrom
KavinduZoysa:fix-issue-2322

Conversation

@KavinduZoysa
Copy link
Contributor

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 clauseDiagnostics API 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.

gimantha
gimantha previously approved these changes Jan 28, 2026
}

TextDocument newTextDocument = textDocument.apply(
TextDocumentChange.from(List.of(io.ballerina.tools.text.TextEdit.from(textRange, clauseStr))
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we remove the absolute reference for TextEdit here and use it after import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we have used org.eclipse.lsp4j.TextEdit, this should be an absolute reference.

@KavinduZoysa KavinduZoysa merged commit f868924 into ballerina-platform:main Feb 2, 2026
3 checks passed
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