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

Update and refactor ballerina/encoding module APIs #907

Closed
ldclakmal opened this issue Jan 28, 2021 · 3 comments · Fixed by ballerina-platform/module-ballerina-url#88
Closed
Assignees
Labels
Area/Security Issues related to stdlib security module/url Team/PCM Protocol connector packages related issues Type/Task Verson/SwanLakeDump All issues planned for Swan Lake GA release

Comments

@ldclakmal
Copy link
Member

Need to update and refactor ballerina/encoding module APIs for Swan Lake
https://docs.google.com/spreadsheets/d/1PyMAlAvgkEL0RpW8CVUj1ccW_61Vm6SMbvadFVYRpSA/edit?usp=sharing

@ldclakmal ldclakmal added module/url Verson/SwanLakeDump All issues planned for Swan Lake GA release Type/Task labels Jan 28, 2021
@ldclakmal ldclakmal modified the milestone: Swan Lake - Alpha Jan 28, 2021
@ldclakmal ldclakmal self-assigned this Jan 28, 2021
@ldclakmal
Copy link
Member Author

It is decided to rename 'encoding' package to 'url' package for Swan Lake release.

Currently, the ballerina/encoding package has only 4 APIs for encoding/decoding URLs. The base16/64 encoding/decoding APIs were introduced to langlib sometime ago and it was decided to remove those APIs from ballerina/encoding module [1] [2]. The mime related encoding/decoding APIs are in ballerina/mime module [3].

public function encodeBase64Url(byte[] input) returns string {}
public function decodeBase64Url(string input) returns byte[]|Error {}
public function encodeUriComponent(string uriComponent, string charset) returns string|Error {}
public function decodeUriComponent(string uriComponent, string charset) returns string|Error {}

Since it is no longer needed to have a separate encoding package only for these APIs, we will be renaming the package as ballerina/url for Swan Lake release onwards. The updated APIs would be:

public function base64Encode(byte[] input) returns string {}
public function base64Decode(string input) returns byte[]|Error {}
public function encode(string url, string charset) returns string|Error {}
public function decode(string url, string charset) returns string|Error {}

[1] ballerina-platform/ballerina-spec#314
[2] https://groups.google.com/g/ballerina-dev/c/sbASEwIl44k/m/0YlP3IcXFwAJ
[3] https://ballerina.io/learn/api-docs/ballerina/#/ballerina/mime/1.0.6/mime/functions

@ldclakmal
Copy link
Member Author

The usage of first 2 APIs is only by ballerina/jwt module and it was decided to move those to ballerina/jwt module as internal functions. The best place to keep second 2 APIs are ballerina/http and it was decided to move those to ballerina/http module.
Finally, we will remove ballerina/encoding module from standard libraries with Swan Lake Alpha 3.

@ldclakmal
Copy link
Member Author

It was decided to rename the module as ballerina/url and keep the following 2 APIs.

public function encode(string str, string charset) returns string|Error {}
public function decode(string str, string charset) returns string|Error {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Security Issues related to stdlib security module/url Team/PCM Protocol connector packages related issues Type/Task Verson/SwanLakeDump All issues planned for Swan Lake GA release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants