ballerina-lang
ballerina-lang copied to clipboard
[Bug]: records fields are set to null when there should be a default value assigned
Description
When a record is created using a predefined type where several nullable fields with default values, these fields are set to null instead of having the default value. This happens in the repository, client.config
Steps to Reproduce
When debugging the following code, the values of the returned client is set to null instead of having default parameters(defaultTokenExpTime, clockSkew, credentialBearer).
import ballerinax/'client.config;
import ballerina/http;
configurable string refreshToken = "";
configurable string clientId = "";
configurable string clientSecret = "";
configurable string spreadsheetId = "";
ConnectionConfig spreadsheetConfig = {
auth: {
clientId: clientId,
clientSecret: clientSecret,
refreshToken: refreshToken,
refreshUrl:"https://www.googleapis.com/oauth2/v3/token"
}
};
public type ConnectionConfig record {|
*config:ConnectionConfig;
# Configurations related to client authentication
http:BearerTokenConfig|config:OAuth2RefreshTokenGrantConfig auth;
# The HTTP version understood by the client
http:HttpVersion httpVersion = http:HTTP_1_1;
|};
public function main() returns error? {
http:ClientConfiguration|error httpClientConfig = config:constructHTTPClientConfig(spreadsheetConfig);
}
Affected Version(s)
2201.9.0
OS, DB, other environment details and versions
No response
Related area
-> Runtime
Related issue(s) (optional)
https://github.com/ballerina-platform/ballerina-library/issues/6023
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response