diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 8059ed6..5146af6 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,13 +1,13 @@ [package] org = "ballerinax" name = "confluent.cavroserdes" -version = "0.1.0" +version = "0.2.0" authors = ["Ballerina"] export=["confluent.cavroserdes"] keywords = ["confluent", "schema_registry", "avro", "serdes"] repository = "https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes" license = ["Apache-2.0"] -distribution = "2201.8.6" +distribution = "2201.10.0" [build-options] observabilityIncluded = true @@ -18,5 +18,5 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.lib" artifactId = "confluent.cavroserdes-native" -version = "0.1.0" -path = "../native/build/libs/confluent.cavroserdes-native-0.1.0.jar" +version = "0.2.0" +path = "../native/build/libs/confluent.cavroserdes-native-0.2.0-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index d74b27f..404164e 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.8.6" +distribution-version = "2201.10.0" [[package]] org = "ballerina" name = "auth" -version = "2.10.0" +version = "2.12.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "crypto"}, @@ -23,7 +23,7 @@ dependencies = [ [[package]] org = "ballerina" name = "avro" -version = "0.1.1" +version = "1.0.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -34,7 +34,7 @@ modules = [ [[package]] org = "ballerina" name = "cache" -version = "3.7.1" +version = "3.8.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "constraint"}, @@ -46,7 +46,7 @@ dependencies = [ [[package]] org = "ballerina" name = "constraint" -version = "1.4.0" +version = "1.5.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -55,7 +55,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.5.0" +version = "2.7.2" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -65,7 +65,7 @@ dependencies = [ [[package]] org = "ballerina" name = "file" -version = "1.9.0" +version = "1.10.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "io"}, @@ -77,7 +77,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.12" +version = "2.12.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -110,7 +110,7 @@ modules = [ [[package]] org = "ballerina" name = "io" -version = "1.6.0" +version = "1.6.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -128,11 +128,12 @@ modules = [ [[package]] org = "ballerina" name = "jwt" -version = "2.10.0" +version = "2.13.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.int"}, {org = "ballerina", name = "lang.string"}, @@ -235,7 +236,7 @@ dependencies = [ [[package]] org = "ballerina" name = "log" -version = "2.9.0" +version = "2.10.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "io"}, @@ -247,18 +248,19 @@ dependencies = [ [[package]] org = "ballerina" name = "mime" -version = "2.9.0" +version = "2.10.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.int"} + {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "log"} ] [[package]] org = "ballerina" name = "oauth2" -version = "2.10.0" +version = "2.12.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "cache"}, @@ -272,7 +274,7 @@ dependencies = [ [[package]] org = "ballerina" name = "observe" -version = "1.2.2" +version = "1.3.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -304,6 +306,7 @@ version = "0.0.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.array"}, {org = "ballerina", name = "lang.error"} ] modules = [ @@ -313,7 +316,7 @@ modules = [ [[package]] org = "ballerina" name = "time" -version = "2.4.0" +version = "2.5.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"} @@ -343,7 +346,7 @@ modules = [ [[package]] org = "ballerinax" name = "confluent.cavroserdes" -version = "0.1.0" +version = "0.2.0" dependencies = [ {org = "ballerina", name = "avro"}, {org = "ballerina", name = "http"}, @@ -359,7 +362,7 @@ modules = [ [[package]] org = "ballerinax" name = "confluent.cregistry" -version = "0.1.1" +version = "0.2.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] diff --git a/ballerina/client.bal b/ballerina/client.bal index 4e873c6..6bf26af 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -59,12 +59,12 @@ isolated function getId(byte[] bytes) returns int = @java:Method { } external; class Deserializer { - isolated function deserializeData(cregistry:Client registry, byte[] data) returns anydata|Error { + isolated function deserializeData(cregistry:Client registry, byte[] data, typedesc targetType) returns anydata|Error { do { int schemaId = getId(data.slice(1, 5)); string retrievedSchema = check registry->getSchemaById(schemaId); avro:Schema avroClient = check new (retrievedSchema); - anydata deserializedData = check avroClient.fromAvro(data.slice(5, data.length())); + anydata deserializedData = check avroClient.fromAvro(data.slice(5, data.length()), targetType); return deserializedData; } on fail error e { return error Error(DESERIALIZATION_ERROR, e); diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index 05c38e0..a01faf3 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -7,7 +7,7 @@ export=["confluent.cavroserdes"] keywords = ["confluent", "schema_registry", "avro", "serdes"] repository = "https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes" license = ["Apache-2.0"] -distribution = "2201.8.6" +distribution = "2201.10.0" [build-options] observabilityIncluded = true diff --git a/build.gradle b/build.gradle index 40c1e4e..3e71de2 100644 --- a/build.gradle +++ b/build.gradle @@ -76,6 +76,8 @@ subprojects { } ballerinaStdLibs "io.ballerina.stdlib:io-ballerina:${stdlibIoVersion}" + ballerinaStdLibs "io.ballerina.lib:avro-ballerina:${stdlibAvroVersion}" + ballerinaStdLibs "io.ballerina.stdlib:http-ballerina:${stdlibHttpVersion}" } } diff --git a/examples/kafka-avro-consumer/Ballerina.toml b/examples/kafka-avro-consumer/Ballerina.toml index 61d615f..10a81a7 100644 --- a/examples/kafka-avro-consumer/Ballerina.toml +++ b/examples/kafka-avro-consumer/Ballerina.toml @@ -2,7 +2,7 @@ org = "wso2" name = "kafka_avro_consumer" version = "0.1.0" -distribution = "2201.8.6" +distribution = "2201.10.0" [build-options] observabilityIncluded = true diff --git a/examples/kafka-avro-producer/Ballerina.toml b/examples/kafka-avro-producer/Ballerina.toml index 78ab3ba..3b9201c 100644 --- a/examples/kafka-avro-producer/Ballerina.toml +++ b/examples/kafka-avro-producer/Ballerina.toml @@ -2,7 +2,7 @@ org = "wso2" name = "kafka_avro_producer" version = "0.1.0" -distribution = "2201.8.6" +distribution = "2201.10.0" [build-options] observabilityIncluded = true diff --git a/gradle.properties b/gradle.properties index ab337cb..a9e1589 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,14 @@ org.gradle.caching=true group=io.ballerina.lib -version=0.1.1-SNAPSHOT -ballerinaLangVersion=2201.8.6 +version=0.2.0-SNAPSHOT +ballerinaLangVersion=2201.10.0 checkstylePluginVersion=10.12.0 spotbugsPluginVersion=5.0.14 shadowJarPluginVersion=8.1.1 downloadPluginVersion=5.4.0 releasePluginVersion=2.8.0 -ballerinaGradlePluginVersion=2.2.4 +ballerinaGradlePluginVersion=3.0.0 jacocoVersion=0.8.10 slf4jVersion=1.7.21 @@ -21,3 +21,5 @@ commonConfigVersion=4.1.0 commonUtilsVersion=5.3.0 stdlibIoVersion=1.6.0 +stdlibAvroVersion=1.0.0 +stdlibHttpVersion=2.12.1 diff --git a/native/src/main/java/io/ballerina/lib/confluent/avro/serdes/AvroDeserializer.java b/native/src/main/java/io/ballerina/lib/confluent/avro/serdes/AvroDeserializer.java index 1b98a69..861cfde 100644 --- a/native/src/main/java/io/ballerina/lib/confluent/avro/serdes/AvroDeserializer.java +++ b/native/src/main/java/io/ballerina/lib/confluent/avro/serdes/AvroDeserializer.java @@ -50,7 +50,7 @@ public static Object deserialize(Environment env, BObject registry, BArray data, BObject deserializer = ValueCreator.createObjectValue(getModule(), DESERIALIZER, null, null); Future future = env.markAsync(); ExecutionCallback executionCallback = new ExecutionCallback(future, typeDesc); - Object[] arguments = new Object[]{registry, true, data, true}; + Object[] arguments = new Object[]{registry, true, data, true, typeDesc, true}; UnionType typeUnion = TypeCreator.createUnionType(PredefinedTypes.TYPE_ANYDATA_ARRAY, PredefinedTypes.TYPE_ERROR); env.getRuntime()