Closed lnash94 closed 2 years ago
As per having an offline discussion with @shafreenAnfar , we came up with the below outcome for current operation id generation. please refer to this ballerina service example :
service on new http:Listener(9090) {
resource function get passenger/[string passportNo]/bookings() {
}
}
for the above example, we currently generated operationId in below way
get:
operationId: "operation_get_/passenger/{passportNo}/bookings"
parameters:
...
during the discussion, suggested removing the operation
from id and making it normalizing id removing special characters and capitalising variable names.
Suggested operationId : getPassengerPassportNoBookings
Service: GET /passenger/[string passportNo]/bookings
Generated operationId: "operation_get_/passenger/{passportNo}/bookings"
Suggested operationId : getPassengerPassportNoBookings
This approach will address the mentioned issue points 2, 3 and partial from 1. @hevayo we are pleased to have input for this improvement approach for the code generations process?
At the same time, we received suggestions to use have some approach for overriding the auto-generated operation id with user given value. Please refer to this https://ballerina-platform.slack.com/archives/C47EAELR1/p1648721879663829
Description: $Subject Currently, we are using the resource function name as the operation name. Ballerina to OpenAPI tool we are unable to generate human-readable operationId, since we can’t capture enough details by looking at the resource and make it unique. Therefore to avoid duplicate behaviour we followed some action rules for generating the operations Id. But the generated operationId has some issues with
The purpose of this task is to improve the operationId generation process to increase human readability.
Describe your task(s)
Related Issues (optional):
Suggested Labels (optional):
Suggested Assignees (optional):