Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix File Content Data-Binding Issue #306

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ballerina/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -5932,11 +5932,11 @@ public isolated client class Client {
# + path - path parameter
# + ref - The name of the commit/branch/tag. Default: the repository’s default branch.
# + return - Response
resource isolated function get repos/[string owner]/[string repo]/contents/[string path](string? ref = ()) returns ContentTree[]|error? {
resource isolated function get repos/[string owner]/[string repo]/contents/[string path](string? ref = ()) returns ContentTreeResponse|error? {
string resourcePath = string `/repos/${getEncodedUri(owner)}/${getEncodedUri(repo)}/contents/${getEncodedUri(path)}`;
map<anydata> queryParam = {"ref": ref};
resourcePath = resourcePath + check getPathForQueryParam(queryParam);
ContentTree[]? response = check self.clientEp->get(resourcePath);
ContentTreeResponse? response = check self.clientEp->get(resourcePath);
return response;
}
# Create or update file contents
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ function testGetLanguagesFromRepository() returns error? {

@test:Config {}
function testGetRepositoryContent() returns error? {
ContentTree[]? response = check github->/repos/[testUsername]/[testUserRepositoryName]/contents/["src"]();
ContentTreeResponse? response = check github->/repos/[testUsername]/[testUserRepositoryName]/contents/["src"]();
if response is ContentTree[] {
test:assertTrue(response.length() > 0);
} else {
Expand Down
5 changes: 3 additions & 2 deletions ballerina/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ public type PullRequestSimpleArr PullRequestSimple[];

public type StatusArr Status[];

public type ContentTreeArr ContentTree[];

public type ContributorArr Contributor[];

public type DependabotAlertArr DependabotAlert[];
Expand Down Expand Up @@ -8013,6 +8011,9 @@ public type Issue_number_labels_body record {
# If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers).
public type WebhookConfigSecret string;

# Content Tree
public type ContentTreeResponse ContentTree|ContentTree[];

# Create a new snapshot of a repository's dependencies.
public type Snapshot record {|
# The version of the repository snapshot submission.
Expand Down
2 changes: 1 addition & 1 deletion docs/spec/Sanitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ This file documents the modifications applied to enhance the usability of the of
## OpenAPI cli command

```bash
bal openapi -i docs/open-api-spec/openapi.json --mode client --license docs/license.txt -o ballerina
bal openapi -i docs/spec/openapi.json --mode client --license docs/license.txt -o ballerina
```
21 changes: 17 additions & 4 deletions docs/spec/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -31523,10 +31523,7 @@
"content": {
"application/vnd.github.object": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/content-tree"
}
"$ref": "#/components/schemas/content-tree-response"
},
"examples": {
"response-if-content-is-a-file": {
Expand Down Expand Up @@ -81269,6 +81266,22 @@
"encoding"
]
},
"content-tree-response": {
"title": "Content Tree",
"description": "Content Tree",
"oneOf": [
{
"type": "object",
"$ref": "#/components/schemas/content-tree"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/content-tree"
}
}
]
},
"content-directory": {
"title": "Content Directory",
"description": "A list of directory items",
Expand Down
Loading