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
Improve the signature of the OpenAPI generated client's method to have clear parameter separation with headers, queries and payload. The HTTP client methods have such separation:
map<string|string[]> parameter to represents the headers
included record parameter to represents the queries
publicisolatedclient classClient {
...# + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - Ok resourceisolatedfunction get albums(GetAlbumsHeadersheaders, *GetAlbumsQueriesqueries) returnsAlbum[]|error {
string resourcePath =string`/albums`;
resourcePath=resourcePath+checkgetPathForQueryParam(queries);
map<string|string[]> httpHeaders =getMapForHeaders(headers);
returnself.clientEp->get(resourcePath, httpHeaders);
}
# + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - Created resourceisolatedfunction post albums(PostAlbumsHeadersheaders, Albumpayload, *PostAlbumsQueriesqueries) returnsAlbum|error {
string resourcePath =string`/albums`;
resourcePath=resourcePath+checkgetPathForQueryParam(queries);
map<string|string[]> httpHeaders =getMapForHeaders(headers);
http:Requestrequest=new;
json jsonBody =payload.toJson();
request.setPayload(jsonBody, "application/json");
returnself.clientEp->post(resourcePath, request, httpHeaders);
}
}
The new header and query records:
# Represents the Headers record for the operation: postAlbumspublictypePostAlbumsHeadersrecord {
string user\-id;
Versionversion;
};
# Represents the Headers record for the operation: getAlbumspublictypeGetAlbumsHeadersrecord {
string user\-id;
Versionversion;
};
publictypeVersion"V2"|"V1";
# Represents the Queries record for the operation: postAlbumspublictypePostAlbumsQueriesrecord {
string? directory?;
};
# Represents the Queries record for the operation: getAlbumspublictypeGetAlbumsQueriesrecord {
# The genrestring? genre?;
};
The text was updated successfully, but these errors were encountered:
Description:
Improve the signature of the OpenAPI generated client's method to have clear parameter separation with headers, queries and payload. The HTTP client methods have such separation:
map<string|string[]>
parameter to represents theheaders
queries
Describe your problem(s)
Consider the following OAS:
The current generated client:
Usage compare to the HTTP client:
Describe your solution(s)
The new generated client:
The new header and query records:
The text was updated successfully, but these errors were encountered: