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
Description:
In general query parameters can have the names full-name, first-name which are not align with the ballerina naming conventions. Describe your problem(s)
when using these query parameters, users may face code readability issues ex: "full-name". The escaped characters can make the code harder to read and understand, leading to confusion and potential mistakes during development. but since these are wired with a path, we cannot overwrite it with the name. we introduced query annotation via this issue
Describe your solution(s)
Introducing a new annotating field @http:Query parameters with metadata. The field will be specified using a syntax similar to the following:
publictypeHttpQueryrecord {|string name?;
|}
HTTP service with resource function
import ballerina/http;
service /v1 on new http:Listener(9090) {
# Annotation using the query parameter name
resource isolated function get customer/groups(@http:Query { name: "customer-group"} customerGroup ) returns Person|error {
//logic here ...
}
}
# Annotation using in-record field
type Person record {
@http:Field {| name: "first-name"|}
string firstName;
int age;
}
Related Issues (optional):
Partial support for #6867
Suggested Labels (optional):
Suggested Assignees (optional):
The text was updated successfully, but these errors were encountered:
lnash94
changed the title
Add support for query parameter name overwrite with the user given name using @http:Query annotation in http client
Add support for query parameter name overwrite with the user given name using @http:Query annotation in http service
Sep 18, 2024
Description:
In general query parameters can have the names
full-name
,first-name
which are not align with the ballerina naming conventions.Describe your problem(s)
when using these query parameters, users may face code readability issues ex: "full-name". The escaped characters can make the code harder to read and understand, leading to confusion and potential mistakes during development. but since these are wired with a path, we cannot overwrite it with the name. we introduced query annotation via this issue
Describe your solution(s)
Introducing a new annotating field
@http:Query
parameters with metadata. The field will be specified using a syntax similar to the following:HTTP service with resource function
Related Issues (optional):
Partial support for #6867
Suggested Labels (optional):
Suggested Assignees (optional):
The text was updated successfully, but these errors were encountered: