From a35bf4e4da98f5b9c48a2b170f75c27d77591c01 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Mon, 12 Aug 2024 11:47:11 +0530 Subject: [PATCH 1/3] Fix OpenAPI overwrite by service config --- .../src/main/java/io/ballerina/stdlib/http/api/HttpService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/HttpService.java b/native/src/main/java/io/ballerina/stdlib/http/api/HttpService.java index 20d29c39e6..7fbf323220 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/HttpService.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/HttpService.java @@ -242,8 +242,8 @@ public URITemplate getUriTemplate() throws URITempl public static HttpService buildHttpService(BObject service, String basePath) { HttpService httpService = new HttpService(service, basePath); BMap serviceConfig = getHttpServiceConfigAnnotation(service); - httpService.populateServiceConfig(serviceConfig); httpService.populateIntrospectionPayload(); + httpService.populateServiceConfig(serviceConfig); return httpService; } From 71e85df2586b49d3bb5e5e6bbe397f9a160a519b Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Mon, 12 Aug 2024 11:48:11 +0530 Subject: [PATCH 2/3] Remove deprecation warning --- ballerina/http_annotation.bal | 1 - 1 file changed, 1 deletion(-) diff --git a/ballerina/http_annotation.bal b/ballerina/http_annotation.bal index d2930b898d..29ebeb299e 100644 --- a/ballerina/http_annotation.bal +++ b/ballerina/http_annotation.bal @@ -35,7 +35,6 @@ public type HttpServiceConfig record {| ListenerAuthConfig[] auth?; string mediaTypeSubtypePrefix?; boolean treatNilableAsOptional = true; - @deprecated byte[] openApiDefinition = []; boolean validation = true; typedesc serviceType?; From 3b6bf30ad8576ce512441ffd4a0feb5bc25217f8 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Mon, 12 Aug 2024 13:16:09 +0530 Subject: [PATCH 3/3] Fix reading service type before modification --- .../codemodifier/contract/ContractInfoModifierTask.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java index 70a8d1106a..173e0caf83 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codemodifier/contract/ContractInfoModifierTask.java @@ -62,6 +62,7 @@ import static io.ballerina.stdlib.http.compiler.Constants.COLON; import static io.ballerina.stdlib.http.compiler.Constants.HTTP; import static io.ballerina.stdlib.http.compiler.Constants.SERVICE_CONFIG_ANNOTATION; +import static io.ballerina.stdlib.http.compiler.Constants.SERVICE_TYPE; import static io.ballerina.stdlib.http.compiler.HttpServiceValidator.getServiceContractTypeDesc; /** @@ -177,7 +178,7 @@ private ServiceDeclarationNode updateServiceConfigAnnotation(TypeDescriptorNode boolean hasServiceType = fields.stream().anyMatch(field -> { if (field.kind().equals(SyntaxKind.SPECIFIC_FIELD)) { SpecificFieldNode specificField = (SpecificFieldNode) field; - return specificField.fieldName().toString().equals("serviceType"); + return specificField.fieldName().toString().trim().equals(SERVICE_TYPE); } return false; });