Skip to content

Commit

Permalink
Merge pull request #49 from ashera96/main
Browse files Browse the repository at this point in the history
Add support for 3.1.x definitions and add error handling for swagger definitions
  • Loading branch information
nadheesh authored Apr 26, 2024
2 parents 13b10a3 + e84792f commit 0c965e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Ballerina Build
uses: ballerina-platform/ballerina-action@nightly
uses: ballerina-platform/ballerina-action@2201.8.6
with:
args:
build
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Ballerina Tests
uses: ballerina-platform/ballerina-action@nightly
uses: ballerina-platform/ballerina-action@2201.8.6
with:
args:
test --code-coverage
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
distribution = "2201.8.4"
org = "wso2"
name = "ai.agent"
version = "0.7.6"
version = "0.7.7"
license = ["Apache-2.0"]
authors = ["Ballerina"]
keywords = ["AI/Agent", "Cost/Freemium"]
Expand Down
4 changes: 2 additions & 2 deletions ballerina/openapi_utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ HttpApiSpecification & readonly|error {
# + return - A OpenApiSpec object
public isolated function parseOpenApiSpec(map<json> openApiSpec) returns OpenApiSpec|UnsupportedOpenApiVersion|OpenApiParsingError {
if !openApiSpec.hasKey("openapi") {
return error UnsupportedOpenApiVersion("OpenAPI version is not specified in the specification.");
return error UnsupportedOpenApiVersion("Unsupported API definition. Supports specifications with version 3.x.x only.");
}
json version = openApiSpec.get("openapi");
if version !is string || !version.matches(re `3\.0\..`) {
if version !is string || !version.matches(re `3\.(0|1)\..`) {
return error UnsupportedOpenApiVersion("Unsupported OpenAPI version. Supports specifications with version 3.x.x only.");
}
OpenApiSpec|error parseSpec = openApiSpec.cloneWithType();
Expand Down

0 comments on commit 0c965e3

Please sign in to comment.