Add support for init parameters in the generated client#435
Merged
TharmiganK merged 9 commits intomainfrom Dec 8, 2025
Merged
Conversation
b7f94f2 to
bb3197c
Compare
dbc14a1 to
7ec0cc3
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #435 +/- ##
==========================================
- Coverage 85.96% 85.82% -0.14%
==========================================
Files 68 68
Lines 6596 6667 +71
Branches 881 890 +9
==========================================
+ Hits 5670 5722 +52
- Misses 662 677 +15
- Partials 264 268 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
daneshk
reviewed
Dec 8, 2025
daneshk
reviewed
Dec 8, 2025
|
daneshk
approved these changes
Dec 8, 2025
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
Introduces support for individual initialization parameters in Ballerina persist clients as an alternative to the existing module-level configurable-based approach. This enables better client reusability and improves developer experience, particularly in low-code environments.
Key improvements:
Fixes: ballerina-platform/ballerina-library#8505
Examples
CLI Usage
Generate persist client with individual init parameters:
Add persist configuration with init parameters to project:
Generated Code
Before (configurable-based):
After (with
--with-init-params):Usage in Application Code
Single database connection:
Multiple database connections with different configurations:
PostgreSQL with schema parameter:
Build Integration
When using
bal persist add --with-init-params, the Ballerina.toml is updated with:This ensures
bal buildregenerates the client with the correct initialization approach.Files NOT Generated
When using
--with-init-params, the following files are not generated:Config.toml- No external configuration filepersist_db_config.bal- No module-level configurablesThis reduces deployment complexity and makes the initialization approach explicit in the code.
Checklist
Updated the specification