- 2201.10.1 (Swan Lake Update 10)
- 2201.10.0 (Swan Lake Update 10)
- 2201.9.4 (Swan Lake Update 9)
- 2201.9.3 (Swan Lake Update 9)
- 2201.9.2 (Swan Lake Update 9)
- 2201.9.1 (Swan Lake Update 9)
- 2201.9.0 (Swan Lake Update 9)
- 2201.8.8 (Swan Lake Update 8)
- 2201.8.7 (Swan Lake Update 8)
- 2201.8.6 (Swan Lake Update 8)
- 2201.8.5 (Swan Lake Update 8)
- 2201.8.4 (Swan Lake Update 8)
- 2201.8.3 (Swan Lake Update 8)
- 2201.8.2 (Swan Lake Update 8)
- 2201.8.1 (Swan Lake Update 8)
- 2201.8.0 (Swan Lake Update 8)
- 2201.7.5 (Swan Lake Update 7)
- 2201.7.4 (Swan Lake Update 7)
- 2201.7.3 (Swan Lake Update 7)
- 2201.7.2 (Swan Lake Update 7)
- 2201.7.1 (Swan Lake Update 7)
- 2201.7.0 (Swan Lake Update 7)
- 2201.6.3 (Swan Lake Update 6)
- 2201.6.2 (Swan Lake Update 6)
- 2201.6.1 (Swan Lake Update 6)
- 2201.6.0 (Swan Lake Update 6)
- 2201.5.5 (Swan Lake Update 5)
- 2201.5.4 (Swan Lake Update 5)
- 2201.5.3 (Swan Lake Update 5)
- 2201.5.2 (Swan Lake Update 5)
- 2201.5.1 (Swan Lake Update 5)
- 2201.5.0 (Swan Lake Update 5)
- 2201.4.3 (Swan Lake Update 4)
- 2201.4.2 (Swan Lake Update 4)
- 2201.4.1 (Swan Lake Update 4)
- 2201.4.0 (Swan Lake Update 4)
- 2201.3.5 (Swan Lake Update 3)
- 2201.3.4 (Swan Lake Update 3)
- 2201.3.3 (Swan Lake Update 3)
- 2201.3.2 (Swan Lake Update 3)
- 2201.3.1 (Swan Lake Update 3)
- 2201.3.0 (Swan Lake Update 3)
- 2201.2.4 (Swan Lake Update 2)
- 2201.2.3 (Swan Lake Update 2)
- 2201.2.2 (Swan Lake Update 2)
- 2201.2.1 (Swan Lake Update 2)
- 2201.2.0 (Swan Lake Update 2)
- 2201.1.2 (Swan Lake Update 1)
- 2201.1.1 (Swan Lake Update 1)
- 2201.1.0 (Swan Lake Update 1)
- 2201.0.5 (Swan Lake)
- 2201.0.4 (Swan Lake)
- 2201.0.3 (Swan Lake)
- 2201.0.2 (Swan Lake)
- 2201.0.1 (Swan Lake)
- 2201.0.0 (Swan Lake)
- Swan Lake Beta6
- Swan Lake Beta5
- Swan Lake Beta4
- Swan Lake Beta3
- Swan Lake Beta2
- Swan Lake Beta1
- Swan Lake Alpha5
- Swan Lake Alpha4
- Swan Lake Alpha3
- Swan Lake Alpha2
- Swan Lake Alpha1
- Swan Lake Preview 8
- Swan Lake Preview 7
- Swan Lake Preview 6
- Swan Lake Preview 5
- Swan Lake Preview 4
- Swan Lake Preview 3
- Swan Lake Preview 2
- Swan Lake Preview 1
- 1.2.54
- 1.2.53
- 1.2.52
- 1.2.51
- 1.2.50
- 1.2.49
- 1.2.48
- 1.2.47
- 1.2.46
- 1.2.45
- 1.2.44
- 1.2.43
- 1.2.42
- 1.2.41
- 1.2.40
- 1.2.39
- 1.2.38
- 1.2.37
- 1.2.36
- 1.2.35
- 1.2.34
- 1.2.33
- 1.2.32
- 1.2.31
- 1.2.30
- 1.2.29
- 1.2.28
- 1.2.27
- 1.2.26
- 1.2.25
- 1.2.24
- 1.2.23
- 1.2.22
- 1.2.21
- 1.2.20
- 1.2.19
- 1.2.18
- 1.2.17
- 1.2.16
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
Overview of Ballerina Swan Lake Beta6
This is the sixth Beta release in a series of planned Alpha and Beta releases leading up to the Ballerina Swan Lake GA release.
It introduces the new language features planned for the Swan Lake GA release and includes improvements and bug fixes done to the compiler, runtime, standard library, and developer tooling after the Swan Lake Beta5 release.
Updating Ballerina
If you are already using Ballerina, you can use the update tool to directly update to Ballerina Swan Lake Beta6 as follows.
To do this, first, execute the command below to get the update tool updated to its latest version.
bal update
If you are using an update tool version below 0.8.14, execute the ballerina update
command to update it. Next, execute the command below to update to Swan Lake Beta5.
bal dist pull slbeta6
Installing Ballerina
If you have not installed Ballerina, then download the installers to install.
Language updates
Improvements
Updated the static type of the unary plus expression to be the same as the static type of the operand. The assignments below are allowed now.
public function main() { int:Unsigned8 a = 32; int:Unsigned8 b = +a; int:Unsigned16 c = 43; int:Unsigned16 d = +c; int:Unsigned32 e = 54; int:Unsigned32 f = +e; byte g = 127; byte h = +g; int:Signed8 i = -32; int:Signed8 j = +i; int:Signed16 k = -65; int:Signed16 l = +k; int:Signed32 m = -64; int:Signed32 n = +m; }
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta6.
Standard library updates
New features
graphql
package
Added support for the GraphQL list type inputs.
http
package
Introduced request and request error interceptors at the service level.
xmldata
package
Added support to convert an XML to a record.
time
package
Added time zone handling support.
Improvements
http
package
Allowed listener-level interceptors to have only the default path.
Breaking changes
graphql
package
Deprecated the add
function in the graphql:Context
object and introduced the set
function.
Old method:
graphql:Context context = new; graphql:Error? result = context.add("key", "<value>"); // Can return an error
New method:
graphql:Context context = new; context.set("key", "<value>"); // Does not return anything
http
package
-
Changed the
RequestContext:add
function toRequestContext:set
.service class DefaultRequestInterceptor { *http:RequestInterceptor; resource function 'default [string... path](http:RequestContext ctx) returns http:NextService|error? { ctx.set("last-interceptor", "default-interceptor"); return ctx.next(); } }
-
Changed the
parseHeader()
function to support multiple header values.http:HeaderValue[] values = check http:parseHeader("text/plain;level=1;q=0.6, application/xml;level=2");
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta6.
Developer tools updates
Improvements
OpenAPI tool
-
Added the
--with-tests
option for the OpenAPI client generation command, which will generate a test file template for all the relevant remote functions of the client. For example,bal openapi -i <openapi contract> --mode client --with-tests
-
Added the
--export-openapi
option for thebuild
command, which will generate OpenAPI contract files for all the services in the current package. For example,bal build --export-openapi
CLI
- Introduced the
--target-dir
flag to therun
,test
,doc
, andclean
commands. With this, you can pass a custom directory to the aforementioned commands. - Added support for creating packages using template packages in Ballerina Central. For example,
bal new -t wso2/choreo_sample
.
Breaking changes
Test framework
Improved the assertFail
function to eliminate the fake return/panic that had to be added after the statement. The signature of the function is changed as follows.
Old signature:
public isolated function assertFail(string msg = "Test Failed!");
New signature:
public isolated function assertFail(string msg = "Test Failed!") returns never;
For example, the function below, which compiled without an issue in Beta5 will throw an unreachable code
compilation error after this signature change.
function testFunc(int|string val) returns int? { if (val is int) { return val; } else { test:assertFail(); } return; //Remove this fake return statement to compile with Swan lake Beta6.
Bug fixes
To view bug fixes, see the GitHub milestone for Swan Lake Beta3 of the repositories below.
Ballerina packages updates
New features
Added support to add an icon
field under the [package]
table. For example,
[package] org = "ballerinax" name = "googleapis.gmail" version = "0.1.0” icon = “images/icon.png”
Info: The specified icon file will be packaged into the
docs/
directory of the Ballerina archive (.bala
). Only the.png
format is supported for the icon.