You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current implementation, the parameter order for websubhub:Service methods is static. Consider the following example:
service/websubhubon securedListener {
remotefunction onRegisterTopic(websubhub:TopicRegistrationmessage, http:Headersheaders)
returnswebsubhub:TopicRegistrationSuccess|websubhub:TopicRegistrationError {
// logic to be executed
}
// other methods
}
Here, the http:Headers parameter is optional, meaning users can choose to omit it. However, if we introduce another optional parameter, such as websubhub:Controller, the method signature would need to be modified as follows:
service/websubhubon securedListener {
remotefunction onRegisterTopic(websubhub:TopicRegistrationmessage, http:Headersheaders, websubhub:ControllerhubController)
returnswebsubhub:TopicRegistrationSuccess|websubhub:TopicRegistrationError {
// logic to be executed
}
// other methods
}
With this approach, users must define the http:Headers parameter even if they do not use it, since the method parameters follow a fixed order.
To enhance flexibility, parameter ordering should not be strictly enforced. Instead, a more dynamic approach should be introduced to determine parameter order at runtime, allowing optional parameters to be omitted without affecting method invocation.
Suggested Improvement
Introduce dynamic parameter order which provides the flexibility to omit optional parameters as needed and define parameters in any order.
Current Limitation
In the current implementation, the parameter order for
websubhub:Service
methods is static. Consider the following example:Here, the
http:Headers
parameter is optional, meaning users can choose to omit it. However, if we introduce another optional parameter, such aswebsubhub:Controller
, the method signature would need to be modified as follows:With this approach, users must define the
http:Headers
parameter even if they do not use it, since the method parameters follow a fixed order.To enhance flexibility, parameter ordering should not be strictly enforced. Instead, a more dynamic approach should be introduced to determine parameter order at runtime, allowing optional parameters to be omitted without affecting method invocation.
Suggested Improvement
Introduce dynamic parameter order which provides the flexibility to omit optional parameters as needed and define parameters in any order.
Version
Ballerina SL 2201.11.0 / Ballerina Websubhub v1.13.0
The text was updated successfully, but these errors were encountered: