Skip to content

Commit

Permalink
Fix integration test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed May 27, 2024
1 parent 49c5671 commit 0f288ae
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ public isolated client class Client {
# + queries - Queries to be sent with the request
# + return - Ok
@MethodImpl {name: "getAlbumsImpl"}
remote isolated function getAlbums(map<string|string[]> headers = {}, typedesc<OkAlbumArray|NotFoundErrorMessage|BadRequestErrorPayload> targetType = <>, *GetAlbumsQueries queries) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invoke"} external;
remote isolated function getAlbums(map<string|string[]> headers = {}, typedesc<AlbumArrayOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType = <>, *GetAlbumsQueries queries) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invoke"} external;

# + headers - Headers to be sent with the request
# + return - Ok
@MethodImpl {name: "getAlbumsIdImpl"}
remote isolated function getAlbumsId(string id, map<string|string[]> headers = {}, typedesc<OkAlbum|NotFoundErrorMessage|BadRequestErrorPayload> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invoke"} external;
remote isolated function getAlbumsId(string id, map<string|string[]> headers = {}, typedesc<AlbumOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invoke"} external;

private isolated function getAlbumsIdImpl(string id, map<string|string[]> headers, typedesc<OkAlbum|NotFoundErrorMessage|BadRequestErrorPayload> targetType) returns OkAlbum|NotFoundErrorMessage|BadRequestErrorPayload|error {
private isolated function getAlbumsIdImpl(string id, map<string|string[]> headers, typedesc<AlbumOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType) returns http:StatusCodeResponse|error {
string resourcePath = string `/albums/${getEncodedUri(id)}`;
return self.clientEp->get(resourcePath, headers, targetType = targetType);
}

private isolated function getAlbumsImpl(map<string|string[]> headers, typedesc<OkAlbumArray|NotFoundErrorMessage|BadRequestErrorPayload> targetType, *GetAlbumsQueries queries) returns OkAlbumArray|NotFoundErrorMessage|BadRequestErrorPayload|error {
private isolated function getAlbumsImpl(map<string|string[]> headers, typedesc<AlbumArrayOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType, *GetAlbumsQueries queries) returns http:StatusCodeResponse|error {
string resourcePath = string `/albums`;
resourcePath = resourcePath + check getPathForQueryParam(queries);
return self.clientEp->get(resourcePath, headers, targetType = targetType);
Expand All @@ -78,9 +78,9 @@ public isolated client class Client {
# + headers - Headers to be sent with the request
# + return - Created
@MethodImpl {name: "postAlbumsImpl"}
remote isolated function postAlbums(Album payload, map<string|string[]> headers = {}, typedesc<CreatedAlbum|ConflictErrorMessage|BadRequestErrorPayload> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invoke"} external;
remote isolated function postAlbums(Album payload, map<string|string[]> headers = {}, typedesc<AlbumCreated|ErrorMessageConflict|ErrorPayloadBadRequest> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invoke"} external;

private isolated function postAlbumsImpl(Album payload, map<string|string[]> headers, typedesc<CreatedAlbum|ConflictErrorMessage|BadRequestErrorPayload> targetType) returns CreatedAlbum|ConflictErrorMessage|BadRequestErrorPayload|error {
private isolated function postAlbumsImpl(Album payload, map<string|string[]> headers, typedesc<AlbumCreated|ErrorMessageConflict|ErrorPayloadBadRequest> targetType) returns http:StatusCodeResponse|error {
string resourcePath = string `/albums`;
http:Request request = new;
json jsonBody = payload.toJson();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,31 @@ public isolated client class Client {
# + headers - Headers to be sent with the request
# + return - Ok
@MethodImpl {name: "getAlbumsIdImpl"}
resource isolated function get albums/[string id](map<string|string[]> headers = {}, typedesc<OkAlbum|NotFoundErrorMessage|BadRequestErrorPayload> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invokeResource"} external;
resource isolated function get albums/[string id](map<string|string[]> headers = {}, typedesc<AlbumOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invokeResource"} external;

# + headers - Headers to be sent with the request
# + queries - Queries to be sent with the request
# + return - Ok
@MethodImpl {name: "getAlbumsImpl"}
resource isolated function get albums(map<string|string[]> headers = {}, typedesc<OkAlbumArray|NotFoundErrorMessage|BadRequestErrorPayload> targetType = <>, *GetAlbumsQueries queries) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invokeResourceWithoutPath"} external;
resource isolated function get albums(map<string|string[]> headers = {}, typedesc<AlbumArrayOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType = <>, *GetAlbumsQueries queries) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invokeResourceWithoutPath"} external;

# + headers - Headers to be sent with the request
# + return - Created
@MethodImpl {name: "postAlbumsImpl"}
resource isolated function post albums(Album payload, map<string|string[]> headers = {}, typedesc<CreatedAlbum|ConflictErrorMessage|BadRequestErrorPayload> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invokeResourceWithoutPath"} external;
resource isolated function post albums(Album payload, map<string|string[]> headers = {}, typedesc<AlbumCreated|ErrorMessageConflict|ErrorPayloadBadRequest> targetType = <>) returns targetType|error = @java:Method {'class: "io.ballerina.openapi.client.GeneratedClient", name: "invokeResourceWithoutPath"} external;

private isolated function getAlbumsIdImpl(string id, map<string|string[]> headers, typedesc<OkAlbum|NotFoundErrorMessage|BadRequestErrorPayload> targetType) returns OkAlbum|NotFoundErrorMessage|BadRequestErrorPayload|error {
private isolated function getAlbumsIdImpl(string id, map<string|string[]> headers, typedesc<AlbumOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType) returns http:StatusCodeResponse|error {
string resourcePath = string `/albums/${getEncodedUri(id)}`;
return self.clientEp->get(resourcePath, headers, targetType = targetType);
}

private isolated function getAlbumsImpl(map<string|string[]> headers, typedesc<OkAlbumArray|NotFoundErrorMessage|BadRequestErrorPayload> targetType, *GetAlbumsQueries queries) returns OkAlbumArray|NotFoundErrorMessage|BadRequestErrorPayload|error {
private isolated function getAlbumsImpl(map<string|string[]> headers, typedesc<AlbumArrayOk|ErrorMessageNotFound|ErrorPayloadBadRequest> targetType, *GetAlbumsQueries queries) returns http:StatusCodeResponse|error {
string resourcePath = string `/albums`;
resourcePath = resourcePath + check getPathForQueryParam(queries);
return self.clientEp->get(resourcePath, headers, targetType = targetType);
}

private isolated function postAlbumsImpl(Album payload, map<string|string[]> headers, typedesc<CreatedAlbum|ConflictErrorMessage|BadRequestErrorPayload> targetType) returns CreatedAlbum|ConflictErrorMessage|BadRequestErrorPayload|error {
private isolated function postAlbumsImpl(Album payload, map<string|string[]> headers, typedesc<AlbumCreated|ErrorMessageConflict|ErrorPayloadBadRequest> targetType) returns http:StatusCodeResponse|error {
string resourcePath = string `/albums`;
http:Request request = new;
json jsonBody = payload.toJson();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ service /api on ep0 {
# http:Ok (Ok)
# http:NotFound (NotFound)
# http:BadRequest (BadRequest)
resource function get albums(string genre) returns Album[]|NotFoundErrorMessage|BadRequestErrorPayload {
resource function get albums(string genre) returns Album[]|ErrorMessageNotFound|ErrorPayloadBadRequest {
}

# + return - returns can be any of following types
# + return - returns can be any of following types
# http:Ok (Ok)
# http:NotFound (NotFound)
# http:BadRequest (BadRequest)
resource function get albums/[string id]() returns Album|NotFoundErrorMessage|BadRequestErrorPayload {
resource function get albums/[string id]() returns Album|ErrorMessageNotFound|ErrorPayloadBadRequest {
}

# + return - returns can be any of following types
# + return - returns can be any of following types
# http:Created (Created)
# http:Conflict (Conflict)
# http:BadRequest (BadRequest)
resource function post albums(@http:Payload Album payload) returns Album|ConflictErrorMessage|BadRequestErrorPayload {
resource function post albums(@http:Payload Album payload) returns Album|ErrorMessageConflict|ErrorPayloadBadRequest {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@

import ballerina/http;

public type CreatedAlbum record {|
*http:Created;
Album body;
record {|int req\-id; string user\-id;|} headers;
|};

public type BadRequestErrorPayload record {|
*http:BadRequest;
ErrorPayload body;
map<string|string[]> headers;
|};

public type OkAlbumArray record {|
*http:Ok;
Album[] body;
public type ErrorMessageConflict record {|
*http:Conflict;
ErrorMessage body;
record {|int req\-id; string user\-id;|} headers;
|};

Expand All @@ -28,6 +16,12 @@ public type Album record {|
string genre;
|};

public type AlbumArrayOk record {|
*http:Ok;
Album[] body;
record {|int req\-id; string user\-id;|} headers;
|};

# Represents the Queries record for the operation: getAlbums
public type GetAlbumsQueries record {
string genre;
Expand All @@ -46,10 +40,9 @@ public type ProxyConfig record {|
string password = "";
|};

public type NotFoundErrorMessage record {|
*http:NotFound;
ErrorMessage body;
record {|int req\-id; string user\-id;|} headers;
public type ErrorPayloadBadRequest record {|
*http:BadRequest;
ErrorPayload body;
|};

public type ErrorPayload record {
Expand All @@ -61,6 +54,12 @@ public type ErrorPayload record {
string method;
};

public type ErrorMessageNotFound record {|
*http:NotFound;
ErrorMessage body;
record {|int req\-id; string user\-id;|} headers;
|};

# Provides settings related to HTTP/1.x protocol.
public type ClientHttp1Settings record {|
# Specifies whether to reuse a connection for multiple requests
Expand All @@ -71,14 +70,14 @@ public type ClientHttp1Settings record {|
ProxyConfig proxy?;
|};

public type ConflictErrorMessage record {|
*http:Conflict;
ErrorMessage body;
public type AlbumOk record {|
*http:Ok;
Album body;
record {|int req\-id; string user\-id;|} headers;
|};

public type OkAlbum record {|
*http:Ok;
public type AlbumCreated record {|
*http:Created;
Album body;
record {|int req\-id; string user\-id;|} headers;
|};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@

import ballerina/http;

public type CreatedAlbum record {|
*http:Created;
Album body;
record {|int req\-id; string user\-id;|} headers;
|};

public type BadRequestErrorPayload record {|
*http:BadRequest;
ErrorPayload body;
map<string|string[]> headers;
|};

public type OkAlbumArray record {|
*http:Ok;
Album[] body;
public type ErrorMessageConflict record {|
*http:Conflict;
ErrorMessage body;
record {|int req\-id; string user\-id;|} headers;
|};

Expand All @@ -28,6 +16,12 @@ public type Album record {|
string genre;
|};

public type AlbumArrayOk record {|
*http:Ok;
Album[] body;
record {|int req\-id; string user\-id;|} headers;
|};

# Represents the Queries record for the operation: getAlbums
public type GetAlbumsQueries record {
string genre;
Expand All @@ -46,10 +40,9 @@ public type ProxyConfig record {|
string password = "";
|};

public type NotFoundErrorMessage record {|
*http:NotFound;
ErrorMessage body;
record {|int req\-id; string user\-id;|} headers;
public type ErrorPayloadBadRequest record {|
*http:BadRequest;
ErrorPayload body;
|};

public type ErrorPayload record {
Expand All @@ -61,6 +54,12 @@ public type ErrorPayload record {
string method;
};

public type ErrorMessageNotFound record {|
*http:NotFound;
ErrorMessage body;
record {|int req\-id; string user\-id;|} headers;
|};

# Provides settings related to HTTP/1.x protocol.
public type ClientHttp1Settings record {|
# Specifies whether to reuse a connection for multiple requests
Expand All @@ -71,14 +70,14 @@ public type ClientHttp1Settings record {|
ProxyConfig proxy?;
|};

public type ConflictErrorMessage record {|
*http:Conflict;
ErrorMessage body;
public type AlbumOk record {|
*http:Ok;
Album body;
record {|int req\-id; string user\-id;|} headers;
|};

public type OkAlbum record {|
*http:Ok;
public type AlbumCreated record {|
*http:Created;
Album body;
record {|int req\-id; string user\-id;|} headers;
|};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

import ballerina/http;

public type OkInline_response_200 record {|
public type Inline_response_200Ok record {|
*http:Ok;
inline_response_200 body;
map<string|string[]> headers;
|};

public type User record {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ballerina/http;

public type AcceptedJson record {|
public type JsonAccepted record {|
*http:Accepted;
json body;
map<string|string[]> headers;
|};
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ public type User record {
string lastName?;
};

public type BadRequestUserXmlString record {|
public type UserXmlStringBadRequest record {|
*http:BadRequest;
User|xml|string body;
map<string|string[]> headers;
|};
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ballerina/http;

public type OkString record {|
public type StringOk record {|
*http:Ok;
string body;
map<string|string[]> headers;
|};
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public type StoreInventory03Response record {|
record {|record {string name?; string place?;}...;|}...;
|};

public type BadRequestStoreInventory05Response record {|
*http:BadRequest;
StoreInventory05Response body;
map<string|string[]> headers;
|};

public type User record {
string name?;
int id?;
Expand All @@ -26,6 +20,11 @@ public type StoreInventory04Response record {|
User...;
|};

public type StoreInventory05ResponseBadRequest record {|
*http:BadRequest;
StoreInventory05Response body;
|};

public type inline_response_200 record {|
string name?;
int age?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

import ballerina/http;

public type BadRequestInline_response_400 record {|
public type Inline_response_400BadRequest record {|
*http:BadRequest;
inline_response_400 body;
map<string|string[]> headers;
|};

public type inline_response_400 record {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ballerina/http;
import ballerina/http;

public type AcceptedString record {|
public type StringAccepted record {|
*http:Accepted;
string body;
map<string|string[]> headers;
|};
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
import ballerina/http;

public type OkJson record {|
*http:Ok;
json body;
map<string|string[]> headers;
public type AnydataJsonXmlBadRequest record {|
*http:BadRequest;
anydata|json|xml body;
|};

public type NotFoundAnydataJsonXml record {|
public type AnydataJsonXmlNotFound record {|
*http:NotFound;
anydata|json|xml body;
map<string|string[]> headers;
|};

public type InternalServerErrorString record {|
*http:InternalServerError;
string body;
map<string|string[]> headers;
public type JsonOk record {|
*http:Ok;
json body;
|};

public type BadRequestAnydataJsonXml record {|
*http:BadRequest;
anydata|json|xml body;
map<string|string[]> headers;
public type StringInternalServerError record {|
*http:InternalServerError;
string body;
|};

public type BadRequestAnydata record {|
public type AnydataBadRequest record {|
*http:BadRequest;
anydata body;
map<string|string[]> headers;
|};

0 comments on commit 0f288ae

Please sign in to comment.