Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configurable variables of record & table types #28461

Merged
merged 7 commits into from
Feb 9, 2021

Conversation

HindujaB
Copy link
Contributor

@HindujaB HindujaB commented Feb 6, 2021

Purpose

  • Add support for record type configurable variables
  • Add support for table type configurable variables

Fixes #28091

Approach

  1. Record type

Ballerina context

type AuthInfo record {
  readonly string username;
  string password;
  string[] scopes?;
};

configurable AuthInfo & readonly testUser = ?;

Toml context

[Pkg.testUser]
username = "john"
password = "abcd"
scopes = ["write"]
  1. Table type

Ballerina context

configurable table<AuthInfo> key(username) & readonly users = ?;

Toml context

[[Pkg.users]]
username = "alice"
password="password1"
scopes=["scope1"]

[[Pkg.users]]
username = "bob"
password="password2"
scopes=["scope1", "scope2"]

Samples

Remarks

related issues
ballerina-platform/ballerina-library#862
ballerina-platform/ballerina-spec#709

The following aspects are considered in implementation

  • Record fields with complex types are yet to be supported
    (Supported field types : int, float, string, boolean, decimal & array of these types )
  • Including additional fields for open records through configuration is not supported. (due to TOML type mapping)
  • Map type is not supported
  • Table with multiple keys is yet to be supported

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@HindujaB HindujaB changed the title [WIP] Support configurable variables of record & table types Support configurable variables of record & table types Feb 6, 2021
@HindujaB HindujaB added the Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime label Feb 6, 2021
@warunalakshitha
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support map values for configurable variables
4 participants