Open isudana opened 2 months ago
Ballerina services do not have user provided names unless they have been defined as service classes. To display names for the Ballerina services in ICP, following naming patterns can be considered
Case 1: Services with base path specified
Derive a name directly from the base path by capitalizing the first letters of each path argument.
service /covid/status on new http:Listener(9000) {
resource function get countries() returns CovidEntry[] {
return covidEntriesTable.toArray();
}
}
Display Name: Covid Status
Case 2: Services without specified base paths
Provide a default name if the service base path is /
(default path) or the service path is not specified.
service / on new http:Listener(9090) {
resource function get greetings() returns string {
return “Hello World!”;
}
}
OR
service on new http:Listener(9090) {
resource function get greetings() returns string {
return “Hello World!”;
}
}
Display Name: Service at /
Following names also can be considered for these default base path cases:
Root
or Root Service
or Default Service
Case 3: Inline service objects
Inline service objects also have /
as the base path
listener http:Listener httpListener = new (8080);
http:Service obj = service object {
remote function get hello() {
io:println("hello!");
}
};
function init() returns error? {
check httpListener.attach(obj);
}
Display Name: Service at /
Case 4: Service class definition
Starting a service from the service class definition also uses /
as the service base path.
public service class HelloService {
*http:Service;
resource function get hello() returns string {
return “Hello World!”;
}
}
So the name Service at /
can be used to display the service in the dashboard.
(Although the service class definition contains a user specified name, it can’t be used as the display name for the service since its base path is identical to inline and default base path service cases)
Description: Currently, service_1 is displayed as the Service Name for a Ballerina Service in ICP. Please see the attached screenshot.
![Uploading icp-ballerina.png…]()
We need to show the correct service name here.
Steps to reproduce:
Affected Versions:
OS, DB, other environment details and versions:
Related Issues (optional):
Suggested Labels (optional):
Suggested Assignees (optional):