Skip to content

Commit

Permalink
Merge pull request #2045 from ballerina-platform/2201.9.x
Browse files Browse the repository at this point in the history
Sync master after `2.11.2` release
  • Loading branch information
TharmiganK authored Jun 17, 2024
2 parents 608d36a + d0b80e9 commit d8e9900
Show file tree
Hide file tree
Showing 38 changed files with 335 additions and 174 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ on:
branches:
- master
- 2201.7.x
- 2201.8.x
- 2201.9.x
types: [opened, synchronize, reopened, labeled, unlabeled]

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-advanced-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-advanced-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-client-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-client-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ modules = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-dispatching-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-dispatching-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ modules = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-interceptor-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-interceptor-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-misc-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-misc-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ function testIntrospectionResourceLink() returns error? {
http:Response response = check httpIntroResTestClient->options("/hello");
test:assertEquals(response.statusCode, 204, msg = "Found unexpected statusCode");
test:assertEquals(check response.getHeader(common:ALLOW), "GET, OPTIONS", msg = "Found unexpected Header");
common:assertHeaderValue(check response.getHeader(common:LINK), "</hello/openapi-doc-dygixywsw>;rel=\"service-desc\"");
common:assertHeaderValue(check response.getHeader(common:LINK),
"</hello/openapi-doc-dygixywsw>;rel=\"service-desc\", </hello/swagger-ui-dygixywsw>;rel=\"swagger-ui\"");

response = check httpIntroResTestClient->options("/hello/greeting");
test:assertEquals(response.statusCode, 204, msg = "Found unexpected statusCode");
test:assertEquals(check response.getHeader(common:ALLOW), "GET, OPTIONS", msg = "Found unexpected Header");
common:assertHeaderValue(check response.getHeader(common:LINK), "</hello/openapi-doc-dygixywsw>;rel=\"service-desc\"");
common:assertHeaderValue(check response.getHeader(common:LINK),
"</hello/openapi-doc-dygixywsw>;rel=\"service-desc\", </hello/swagger-ui-dygixywsw>;rel=\"swagger-ui\"");
}

@test:Config {}
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-resiliency-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-resiliency-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-security-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-security-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http-service-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http-service-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/http2-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.11.2-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.11.2.jar"
2 changes: 1 addition & 1 deletion ballerina-tests/http2-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.7.1"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ graalvmCompatible = true
groupId = "io.ballerina.stdlib"
artifactId = "http-native"
version = "2.11.2"
path = "../native/build/libs/http-native-2.11.2-SNAPSHOT.jar"
path = "../native/build/libs/http-native-2.11.2.jar"

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
Expand Down
2 changes: 1 addition & 1 deletion ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ id = "http-compiler-plugin"
class = "io.ballerina.stdlib.http.compiler.HttpCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/http-compiler-plugin-2.11.2-SNAPSHOT.jar"
path = "../compiler-plugin/build/libs/http-compiler-plugin-2.11.2.jar"
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- [Introduce default status code response record](https://github.com/ballerina-platform/ballerina-library/issues/6491)

## [2.11.2] - 2024-06-14

### Added

- [Generate and host SwaggerUI for the generated OpenAPI specification as a built-in resource](https://github.com/ballerina-platform/ballerina-library/issues/6622)

### Fixed

- [Remove the resource level annotation restrictions](https://github.com/ballerina-platform/ballerina-library/issues/5831)

## [2.11.1] - 2024-05-29

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,6 @@ public void testInValidReturnTypes() {
"'anydata|http:Response|http:StatusCodeResponse|error', but found 'readonly & error[]'", HTTP_102);
}

@Test
public void testInValidAnnotations() {
Package currentPackage = loadPackage("sample_package_3");
PackageCompilation compilation = currentPackage.getCompilation();
DiagnosticResult diagnosticResult = compilation.diagnosticResult();
Assert.assertEquals(diagnosticResult.errorCount(), 1);
assertError(diagnosticResult, 0, "invalid resource method annotation type: expected 'http:ResourceConfig', " +
"but found 'display '", CompilerPluginTestConstants.HTTP_103);
}

@Test
public void testInValidInputPayloadArgs() {
Package currentPackage = loadPackage("sample_package_4");
Expand Down Expand Up @@ -410,22 +400,21 @@ public void testResourceErrorPositions() {
Package currentPackage = loadPackage("sample_package_15");
PackageCompilation compilation = currentPackage.getCompilation();
DiagnosticResult diagnosticResult = compilation.diagnosticResult();
Assert.assertEquals(diagnosticResult.errorCount(), 14);
Assert.assertEquals(diagnosticResult.errorCount(), 13);
// only testing the error locations
assertErrorPosition(diagnosticResult, 0, "(29:44,29:60)");
assertErrorPosition(diagnosticResult, 1, "(34:5,34:12)");
assertErrorPosition(diagnosticResult, 2, "(42:86,42:87)");
assertErrorPosition(diagnosticResult, 3, "(46:57,46:60)");
assertErrorPosition(diagnosticResult, 4, "(50:63,50:66)");
assertErrorPosition(diagnosticResult, 5, "(54:66,54:69)");
assertErrorPosition(diagnosticResult, 6, "(58:77,58:80)");
assertErrorPosition(diagnosticResult, 7, "(62:76,62:79)");
assertErrorPosition(diagnosticResult, 8, "(66:76,66:82)");
assertErrorPosition(diagnosticResult, 9, "(73:45,73:46)");
assertErrorPosition(diagnosticResult, 10, "(81:43,81:46)");
assertErrorPosition(diagnosticResult, 11, "(81:61,81:64)");
assertErrorPosition(diagnosticResult, 12, "(81:79,81:82)");
assertErrorPosition(diagnosticResult, 13, "(85:77,85:93)");
assertErrorPosition(diagnosticResult, 1, "(42:86,42:87)");
assertErrorPosition(diagnosticResult, 2, "(46:57,46:60)");
assertErrorPosition(diagnosticResult, 3, "(50:63,50:66)");
assertErrorPosition(diagnosticResult, 4, "(54:66,54:69)");
assertErrorPosition(diagnosticResult, 5, "(58:77,58:80)");
assertErrorPosition(diagnosticResult, 6, "(62:76,62:79)");
assertErrorPosition(diagnosticResult, 7, "(66:76,66:82)");
assertErrorPosition(diagnosticResult, 8, "(73:45,73:46)");
assertErrorPosition(diagnosticResult, 9, "(81:43,81:46)");
assertErrorPosition(diagnosticResult, 10, "(81:61,81:64)");
assertErrorPosition(diagnosticResult, 11, "(81:79,81:82)");
assertErrorPosition(diagnosticResult, 12, "(85:77,85:93)");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ private CompilerPluginTestConstants() {}

public static final String HTTP_101 = "HTTP_101";
public static final String HTTP_102 = "HTTP_102";
public static final String HTTP_103 = "HTTP_103";
public static final String HTTP_104 = "HTTP_104";
public static final String HTTP_105 = "HTTP_105";
public static final String HTTP_106 = "HTTP_106";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import static io.ballerina.stdlib.http.compiler.Constants.ALLOWED_INTERCEPTOR_RETURN_UNION;
import static io.ballerina.stdlib.http.compiler.Constants.ALLOWED_RETURN_UNION;
import static io.ballerina.stdlib.http.compiler.Constants.RESOURCE_CONFIG_ANNOTATION;
import static io.ballerina.tools.diagnostics.DiagnosticSeverity.ERROR;
import static io.ballerina.tools.diagnostics.DiagnosticSeverity.INTERNAL;

Expand All @@ -33,8 +32,6 @@ public enum HttpDiagnosticCodes {
HTTP_101("HTTP_101", "remote methods are not allowed in http:Service", ERROR),
HTTP_102("HTTP_102", "invalid resource method return type: expected '" + ALLOWED_RETURN_UNION +
"', but found '%s'", ERROR),
HTTP_103("HTTP_103", "invalid resource method annotation type: expected 'http:" + RESOURCE_CONFIG_ANNOTATION +
"', but found '%s'", ERROR),
HTTP_104("HTTP_104", "invalid annotation type on param '%s': expected one of the following types: " +
"'http:Payload', 'http:CallerInfo', 'http:Header', 'http:Query'", ERROR),
HTTP_105("HTTP_105", "invalid resource parameter '%s'", ERROR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ private static void extractResourceAnnotationAndValidate(SyntaxNodeAnalysisConte
String[] strings = annotName.split(Constants.COLON);
if (RESOURCE_CONFIG_ANNOTATION.equals(strings[strings.length - 1].trim())) {
validateLinksInResourceConfig(ctx, member, annotation, linksMetaData);
continue;
}
}
reportInvalidResourceAnnotation(ctx, annotReference.location(), annotName);
}
}

Expand Down Expand Up @@ -923,11 +921,6 @@ private static boolean isValidReturnTypeWithCaller(TypeSymbol returnTypeDescript
}
}

private static void reportInvalidResourceAnnotation(SyntaxNodeAnalysisContext ctx, Location location,
String annotName) {
updateDiagnostic(ctx, location, HttpDiagnosticCodes.HTTP_103, annotName);
}

private static void reportInvalidParameterAnnotation(SyntaxNodeAnalysisContext ctx, Location location,
String paramName) {
updateDiagnostic(ctx, location, HttpDiagnosticCodes.HTTP_104, paramName);
Expand Down
Loading

0 comments on commit d8e9900

Please sign in to comment.