Skip to content

Commit

Permalink
Add test for header name field
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Sep 23, 2024
1 parent fc20dcd commit 1f3caa0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ paths:
$ref: "#/components/schemas/ErrorPayload"
post:
operationId: postAlbums
parameters:
- name: X-API-VERSION
in: header
required: true
schema:
type: string
- name: X-CORRELATION-ID
in: header
required: true
schema:
type: integer
format: int64
- name: ids
in: header
required: true
schema:
type: array
items:
type: string
requestBody:
content:
application/json:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ballerina/http;
type OASServiceType service object {
*http:ServiceContract;
resource function get albums(string[] artists = [], @http:Header {name: "X-API-VERSION"} string? xAPIVERSION = "v1") returns Album[];
resource function post albums(Album payload) returns Album;
resource function post albums(@http:Header Headers headers, Album payload) returns Album;
resource function get albums/[string id]() returns Album;
};

Expand All @@ -18,3 +18,11 @@ public type Album record {|
@jsondata:Name {value: titleField}
string title;
|};

public type Headers record {|
@http:Header {name: "X-API-VERSION"}
string apiVersion;
@http:Header {name: "X-CORRELATION-ID"}
int correlationId;
string[] ids;
|};

0 comments on commit 1f3caa0

Please sign in to comment.