diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d48313a35..359943b721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ ## [Unreleased](https://github.com/aklivity/zilla/tree/HEAD) -[Full Changelog](https://github.com/aklivity/zilla/compare/0.9.103...HEAD) +[Full Changelog](https://github.com/aklivity/zilla/compare/0.9.104...HEAD) + +**Merged pull requests:** + +- Json deserialization of nullable fields [\#1342](https://github.com/aklivity/zilla/pull/1342) ([akrambek](https://github.com/akrambek)) + +## [0.9.104](https://github.com/aklivity/zilla/tree/0.9.104) (2024-12-02) + +[Full Changelog](https://github.com/aklivity/zilla/compare/0.9.103...0.9.104) **Fixed bugs:** diff --git a/build/flyweight-maven-plugin/pom.xml b/build/flyweight-maven-plugin/pom.xml index faaedad5c3..a551f083a1 100644 --- a/build/flyweight-maven-plugin/pom.xml +++ b/build/flyweight-maven-plugin/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla build - 0.9.104 + 0.9.105 ../pom.xml diff --git a/build/pom.xml b/build/pom.xml index ca1ce2c11e..f68c512c37 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla zilla - 0.9.104 + 0.9.105 ../pom.xml diff --git a/cloud/docker-image/pom.xml b/cloud/docker-image/pom.xml index e5d30f5028..78e8f6af5d 100644 --- a/cloud/docker-image/pom.xml +++ b/cloud/docker-image/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla cloud - 0.9.104 + 0.9.105 ../pom.xml diff --git a/cloud/helm-chart/pom.xml b/cloud/helm-chart/pom.xml index 2867ed4a6d..9dbe8caf85 100644 --- a/cloud/helm-chart/pom.xml +++ b/cloud/helm-chart/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla cloud - 0.9.104 + 0.9.105 ../pom.xml diff --git a/cloud/pom.xml b/cloud/pom.xml index aebc0391c2..c599f77d1b 100644 --- a/cloud/pom.xml +++ b/cloud/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla zilla - 0.9.104 + 0.9.105 ../pom.xml diff --git a/conf/pom.xml b/conf/pom.xml index 076237a3b3..56168c5773 100644 --- a/conf/pom.xml +++ b/conf/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla zilla - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-amqp.spec/pom.xml b/incubator/binding-amqp.spec/pom.xml index 67b0337e42..009ce24c04 100644 --- a/incubator/binding-amqp.spec/pom.xml +++ b/incubator/binding-amqp.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-amqp/pom.xml b/incubator/binding-amqp/pom.xml index 4db6113d13..62fc872775 100644 --- a/incubator/binding-amqp/pom.xml +++ b/incubator/binding-amqp/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-pgsql-kafka.spec/pom.xml b/incubator/binding-pgsql-kafka.spec/pom.xml index de63c0f001..23275e4c8b 100644 --- a/incubator/binding-pgsql-kafka.spec/pom.xml +++ b/incubator/binding-pgsql-kafka.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-pgsql-kafka/pom.xml b/incubator/binding-pgsql-kafka/pom.xml index 8bb92ad8c0..3c6e435c80 100644 --- a/incubator/binding-pgsql-kafka/pom.xml +++ b/incubator/binding-pgsql-kafka/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-pgsql.spec/pom.xml b/incubator/binding-pgsql.spec/pom.xml index 79804d2889..fc7544cc8b 100644 --- a/incubator/binding-pgsql.spec/pom.xml +++ b/incubator/binding-pgsql.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-pgsql/pom.xml b/incubator/binding-pgsql/pom.xml index d7a08d4747..ad1268fbe6 100644 --- a/incubator/binding-pgsql/pom.xml +++ b/incubator/binding-pgsql/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-risingwave.spec/pom.xml b/incubator/binding-risingwave.spec/pom.xml index 215ad64462..e0b3634aad 100644 --- a/incubator/binding-risingwave.spec/pom.xml +++ b/incubator/binding-risingwave.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/binding-risingwave/pom.xml b/incubator/binding-risingwave/pom.xml index dfd936842b..44f669f74f 100644 --- a/incubator/binding-risingwave/pom.xml +++ b/incubator/binding-risingwave/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/command-dump/pom.xml b/incubator/command-dump/pom.xml index 1342660e37..fcd6159b49 100644 --- a/incubator/command-dump/pom.xml +++ b/incubator/command-dump/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/command-log/pom.xml b/incubator/command-log/pom.xml index 08589acbe1..2a3d914df7 100644 --- a/incubator/command-log/pom.xml +++ b/incubator/command-log/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/command-tune/pom.xml b/incubator/command-tune/pom.xml index 6d14bf7f71..a7412b238e 100644 --- a/incubator/command-tune/pom.xml +++ b/incubator/command-tune/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla incubator - 0.9.104 + 0.9.105 ../pom.xml diff --git a/incubator/pom.xml b/incubator/pom.xml index 5a3ece151a..c9e6005ea7 100644 --- a/incubator/pom.xml +++ b/incubator/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla zilla - 0.9.104 + 0.9.105 ../pom.xml diff --git a/manager/pom.xml b/manager/pom.xml index 32f6d207b5..3fb4c61482 100644 --- a/manager/pom.xml +++ b/manager/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla zilla - 0.9.104 + 0.9.105 ../pom.xml diff --git a/pom.xml b/pom.xml index 5196bb56a3..3fde78ad14 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 4.0.0 io.aklivity.zilla zilla - 0.9.104 + 0.9.105 pom zilla https://github.com/aklivity/zilla @@ -331,6 +331,7 @@ true **/generated-*/**/* + **/org/apache/avro/**/* diff --git a/runtime/binding-asyncapi/pom.xml b/runtime/binding-asyncapi/pom.xml index 7616599efe..b71b4eee24 100644 --- a/runtime/binding-asyncapi/pom.xml +++ b/runtime/binding-asyncapi/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-echo/pom.xml b/runtime/binding-echo/pom.xml index abc93eb0eb..f42ebfbb26 100644 --- a/runtime/binding-echo/pom.xml +++ b/runtime/binding-echo/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-fan/pom.xml b/runtime/binding-fan/pom.xml index 6f07c6a04c..473177f1b3 100644 --- a/runtime/binding-fan/pom.xml +++ b/runtime/binding-fan/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-filesystem/pom.xml b/runtime/binding-filesystem/pom.xml index 2cc801e2a5..c53b72a6a2 100644 --- a/runtime/binding-filesystem/pom.xml +++ b/runtime/binding-filesystem/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-grpc-kafka/pom.xml b/runtime/binding-grpc-kafka/pom.xml index 6bdd1c443d..e4058651d2 100644 --- a/runtime/binding-grpc-kafka/pom.xml +++ b/runtime/binding-grpc-kafka/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-grpc/pom.xml b/runtime/binding-grpc/pom.xml index 215ebe6ff1..068be7879d 100644 --- a/runtime/binding-grpc/pom.xml +++ b/runtime/binding-grpc/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-http-filesystem/pom.xml b/runtime/binding-http-filesystem/pom.xml index 41bdf9af78..8145f299f3 100644 --- a/runtime/binding-http-filesystem/pom.xml +++ b/runtime/binding-http-filesystem/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-http-kafka/pom.xml b/runtime/binding-http-kafka/pom.xml index c21fe28622..e223682eda 100644 --- a/runtime/binding-http-kafka/pom.xml +++ b/runtime/binding-http-kafka/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-http/pom.xml b/runtime/binding-http/pom.xml index 8790de243d..2c38869512 100644 --- a/runtime/binding-http/pom.xml +++ b/runtime/binding-http/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-kafka-grpc/pom.xml b/runtime/binding-kafka-grpc/pom.xml index 8d94520076..87030bece5 100644 --- a/runtime/binding-kafka-grpc/pom.xml +++ b/runtime/binding-kafka-grpc/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-kafka/pom.xml b/runtime/binding-kafka/pom.xml index fc86411330..1731d369ad 100644 --- a/runtime/binding-kafka/pom.xml +++ b/runtime/binding-kafka/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-mqtt-kafka/pom.xml b/runtime/binding-mqtt-kafka/pom.xml index 8ae178c951..60473bbfc8 100644 --- a/runtime/binding-mqtt-kafka/pom.xml +++ b/runtime/binding-mqtt-kafka/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-mqtt/pom.xml b/runtime/binding-mqtt/pom.xml index f46e1f1b3c..4c4e4822d9 100644 --- a/runtime/binding-mqtt/pom.xml +++ b/runtime/binding-mqtt/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-openapi-asyncapi/pom.xml b/runtime/binding-openapi-asyncapi/pom.xml index 2d6b5f0029..a250ab4cf9 100644 --- a/runtime/binding-openapi-asyncapi/pom.xml +++ b/runtime/binding-openapi-asyncapi/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-openapi/pom.xml b/runtime/binding-openapi/pom.xml index 0bc08f6f5f..bda5e3e848 100644 --- a/runtime/binding-openapi/pom.xml +++ b/runtime/binding-openapi/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-proxy/pom.xml b/runtime/binding-proxy/pom.xml index 6f2ccdeee4..3bc3c68805 100644 --- a/runtime/binding-proxy/pom.xml +++ b/runtime/binding-proxy/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-sse-kafka/pom.xml b/runtime/binding-sse-kafka/pom.xml index 377da55081..1cc170a391 100644 --- a/runtime/binding-sse-kafka/pom.xml +++ b/runtime/binding-sse-kafka/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-sse/pom.xml b/runtime/binding-sse/pom.xml index 486c078834..fb575a4369 100644 --- a/runtime/binding-sse/pom.xml +++ b/runtime/binding-sse/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-tcp/pom.xml b/runtime/binding-tcp/pom.xml index 4798730a00..0f94732739 100644 --- a/runtime/binding-tcp/pom.xml +++ b/runtime/binding-tcp/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-tls/pom.xml b/runtime/binding-tls/pom.xml index 8f47efac31..3268ba8bed 100644 --- a/runtime/binding-tls/pom.xml +++ b/runtime/binding-tls/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/binding-ws/pom.xml b/runtime/binding-ws/pom.xml index 6380d06c37..d7f21b8c3f 100644 --- a/runtime/binding-ws/pom.xml +++ b/runtime/binding-ws/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/catalog-apicurio/pom.xml b/runtime/catalog-apicurio/pom.xml index 7a86b7a225..14f847d0c3 100644 --- a/runtime/catalog-apicurio/pom.xml +++ b/runtime/catalog-apicurio/pom.xml @@ -6,7 +6,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/catalog-filesystem/pom.xml b/runtime/catalog-filesystem/pom.xml index 496b0b8ada..a24e6e743c 100644 --- a/runtime/catalog-filesystem/pom.xml +++ b/runtime/catalog-filesystem/pom.xml @@ -6,7 +6,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/catalog-inline/pom.xml b/runtime/catalog-inline/pom.xml index f45daa73b0..6394f8b2ab 100644 --- a/runtime/catalog-inline/pom.xml +++ b/runtime/catalog-inline/pom.xml @@ -6,7 +6,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/catalog-karapace/pom.xml b/runtime/catalog-karapace/pom.xml index b0703966de..04d23e8f13 100644 --- a/runtime/catalog-karapace/pom.xml +++ b/runtime/catalog-karapace/pom.xml @@ -6,7 +6,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/catalog-schema-registry/pom.xml b/runtime/catalog-schema-registry/pom.xml index e0a584989a..62e211f3ee 100644 --- a/runtime/catalog-schema-registry/pom.xml +++ b/runtime/catalog-schema-registry/pom.xml @@ -6,7 +6,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/command-metrics/pom.xml b/runtime/command-metrics/pom.xml index d92880e4dc..511b0638dd 100644 --- a/runtime/command-metrics/pom.xml +++ b/runtime/command-metrics/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/command-start/pom.xml b/runtime/command-start/pom.xml index 6938728725..365ce21712 100644 --- a/runtime/command-start/pom.xml +++ b/runtime/command-start/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/command-stop/pom.xml b/runtime/command-stop/pom.xml index 24a45ae232..d0b9fce59e 100644 --- a/runtime/command-stop/pom.xml +++ b/runtime/command-stop/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/command-version/pom.xml b/runtime/command-version/pom.xml index 9e0e76da78..9d77c1ac84 100644 --- a/runtime/command-version/pom.xml +++ b/runtime/command-version/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/command/pom.xml b/runtime/command/pom.xml index c05dee8485..469eebe937 100644 --- a/runtime/command/pom.xml +++ b/runtime/command/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/common/pom.xml b/runtime/common/pom.xml index a77ddf8a12..be89c00677 100644 --- a/runtime/common/pom.xml +++ b/runtime/common/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/engine/pom.xml b/runtime/engine/pom.xml index 48e2350783..40e2dcd983 100644 --- a/runtime/engine/pom.xml +++ b/runtime/engine/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/exporter-otlp/pom.xml b/runtime/exporter-otlp/pom.xml index 9f6855a734..ba3701abd0 100644 --- a/runtime/exporter-otlp/pom.xml +++ b/runtime/exporter-otlp/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/exporter-prometheus/pom.xml b/runtime/exporter-prometheus/pom.xml index 6e40d5df66..a8ffbe9456 100644 --- a/runtime/exporter-prometheus/pom.xml +++ b/runtime/exporter-prometheus/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/exporter-stdout/pom.xml b/runtime/exporter-stdout/pom.xml index 1df54635ec..1ca079bfd5 100644 --- a/runtime/exporter-stdout/pom.xml +++ b/runtime/exporter-stdout/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/filesystem-http/pom.xml b/runtime/filesystem-http/pom.xml index fdcb212f41..f90c4e256b 100644 --- a/runtime/filesystem-http/pom.xml +++ b/runtime/filesystem-http/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/guard-jwt/pom.xml b/runtime/guard-jwt/pom.xml index 3e8e40b3a8..2c3e1bdbb3 100644 --- a/runtime/guard-jwt/pom.xml +++ b/runtime/guard-jwt/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/metrics-grpc/pom.xml b/runtime/metrics-grpc/pom.xml index f83a41d3f4..36ba6d93af 100644 --- a/runtime/metrics-grpc/pom.xml +++ b/runtime/metrics-grpc/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/metrics-http/pom.xml b/runtime/metrics-http/pom.xml index 9c58ecec51..b0cf3c8246 100644 --- a/runtime/metrics-http/pom.xml +++ b/runtime/metrics-http/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/metrics-stream/pom.xml b/runtime/metrics-stream/pom.xml index 2f34480ef6..4778f0f533 100644 --- a/runtime/metrics-stream/pom.xml +++ b/runtime/metrics-stream/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/model-avro/pom.xml b/runtime/model-avro/pom.xml index 0454137f22..b984ee1d2a 100644 --- a/runtime/model-avro/pom.xml +++ b/runtime/model-avro/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroModelHandler.java b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroModelHandler.java index 7644e168bc..4bf691713f 100644 --- a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroModelHandler.java +++ b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroModelHandler.java @@ -20,6 +20,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.agrona.DirectBuffer; @@ -51,6 +52,7 @@ import io.aklivity.zilla.runtime.model.avro.internal.types.AvroFloatFW; import io.aklivity.zilla.runtime.model.avro.internal.types.AvroIntFW; import io.aklivity.zilla.runtime.model.avro.internal.types.AvroLongFW; +import io.aklivity.zilla.runtime.model.avro.internal.types.AvroUnionFW; import io.aklivity.zilla.runtime.model.avro.internal.types.OctetsFW; public abstract class AvroModelHandler @@ -88,6 +90,7 @@ public abstract class AvroModelHandler private final AvroLongFW longRO; private final AvroFloatFW floatRO; private final AvroDoubleFW doubleRO; + private final AvroUnionFW unionRO; protected int progress; @@ -120,6 +123,7 @@ protected AvroModelHandler( this.longRO = new AvroLongFW(); this.floatRO = new AvroFloatFW(); this.doubleRO = new AvroDoubleFW(); + this.unionRO = new AvroUnionFW(); } @@ -400,6 +404,25 @@ private void extract( } progress += fixedSize; break; + case UNION: + List types = schema.getTypes(); + Integer nullIndex = schema.getIndexNamed("null"); + if (nullIndex != null && types.size() == 2) + { + AvroUnionFW avroUnion = unionRO.wrap(data, progress, limit); + int index = avroUnion.index(); + + if (index != nullIndex) + { + progress = avroUnion.limit(); + + int nonNullIndex = nullIndex ^ 1; + Schema nonNull = types.get(nonNullIndex); + + extract(nonNull, data, limit, field); + } + } + break; default: break; } diff --git a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java index a9fae1f7d8..5d1ab9dfe5 100644 --- a/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java +++ b/runtime/model-avro/src/main/java/io/aklivity/zilla/runtime/model/avro/internal/AvroWriteConverterHandler.java @@ -22,6 +22,7 @@ import org.apache.avro.generic.GenericDatumReader; import org.apache.avro.generic.GenericDatumWriter; import org.apache.avro.generic.GenericRecord; +import org.apache.avro.io.CanonicalJsonDecoder; import io.aklivity.zilla.runtime.engine.EngineContext; import io.aklivity.zilla.runtime.engine.catalog.CatalogHandler; @@ -103,7 +104,8 @@ private int serializeJsonRecord( GenericRecord record = supplyRecord(schemaId); in.wrap(buffer, index, length); expandable.wrap(expandable.buffer()); - record = reader.read(record, decoderFactory.jsonDecoder(schema, in)); + CanonicalJsonDecoder decoder = new CanonicalJsonDecoder(schema, in); + record = reader.read(record, decoder); encoderFactory.binaryEncoder(expandable, encoder); writer.write(record, encoder); encoder.flush(); diff --git a/runtime/model-avro/src/main/java/org/apache/avro/io/CanonicalJsonDecoder.java b/runtime/model-avro/src/main/java/org/apache/avro/io/CanonicalJsonDecoder.java new file mode 100644 index 0000000000..fd08d9836d --- /dev/null +++ b/runtime/model-avro/src/main/java/org/apache/avro/io/CanonicalJsonDecoder.java @@ -0,0 +1,263 @@ +/* + * Copyright 2021-2024 Aklivity Inc + * + * Licensed under the Aklivity Community License (the "License"); you may not use + * this file except in compliance with the License. You may obtain a copy of the + * License at + * + * https://www.aklivity.io/aklivity-community-license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.avro.io; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE + * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +import org.apache.avro.AvroTypeException; +import org.apache.avro.Schema; +import org.apache.avro.io.parsing.Symbol; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.charset.Charset; +import java.util.List; + +public final class CanonicalJsonDecoder extends JsonDecoder +{ + private static final Method ADVANCE; + private static final Method ERROR; + private static final Field IN; + + static + { + try + { + ADVANCE = JsonDecoder.class.getDeclaredMethod("advance", Symbol.class); + ERROR = JsonDecoder.class.getDeclaredMethod("error", String.class); + IN = JsonDecoder.class.getDeclaredField("in"); + ADVANCE.setAccessible(true); + ERROR.setAccessible(true); + IN.setAccessible(true); + } + catch (NoSuchMethodException ex) + { + throw new RuntimeException(ex); + } + catch (SecurityException ex) + { + throw new RuntimeException(ex); + } + catch (NoSuchFieldException ex) + { + throw new RuntimeException(ex); + } + } + + + public CanonicalJsonDecoder(final Schema schema, final InputStream in) + throws IOException + { + super(schema, in); + } + + public CanonicalJsonDecoder(final Schema schema, final String in) + throws IOException + { + this(schema, new ByteArrayInputStream(in.getBytes(Charset.forName("UTF-8")))); + } + + /** + * Overwrite this function to optime json decoding of union {null, type}. + * + * @return + * @throws IOException + */ + @Override + public int readIndex() throws IOException + { + try + { + ADVANCE.invoke(this, Symbol.UNION); + JsonParser lin = getParser(); + Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); + + String label; + final JsonToken currentToken = lin.getCurrentToken(); + if (currentToken == JsonToken.VALUE_NULL) + { + label = "null"; + } + else if (CanonicalJsonEncoder.isNullableSingle(a)) + { + label = CanonicalJsonEncoder.getNullableSingle(a); + } + else if (currentToken == JsonToken.START_OBJECT + && lin.nextToken() == JsonToken.FIELD_NAME) + { + label = lin.getText(); + lin.nextToken(); + parser.pushSymbol(Symbol.UNION_END); + } + else + { + throw (AvroTypeException) ERROR.invoke(this, "start-union"); + } + int n = a.findLabel(label); + if (n < 0) + { + throw new AvroTypeException("Unknown union branch " + label); + } + parser.pushSymbol(a.getSymbol(n)); + return n; + } + catch (IllegalAccessException ex) + { + throw new RuntimeException(ex); + } + catch (IllegalArgumentException ex) + { + throw new RuntimeException(ex); + } + catch (InvocationTargetException ex) + { + throw new RuntimeException(ex); + } + } + + /** + * Overwrite to inject default values. + * + * @param input + * @param top + * @return + * @throws IOException + */ + + @Override + public Symbol doAction(final Symbol input, final Symbol top) throws IOException + { + try + { + JsonParser in = getParser(); + if (top instanceof Symbol.FieldAdjustAction) + { + Symbol.FieldAdjustAction fa = (Symbol.FieldAdjustAction) top; + String name = fa.fname; + if (currentReorderBuffer != null) + { + List node = currentReorderBuffer.savedFields.get(name); + if (node != null) + { + currentReorderBuffer.savedFields.remove(name); + currentReorderBuffer.origParser = in; + setParser(makeParser(node)); + return null; + } + } + if (in.getCurrentToken() == JsonToken.FIELD_NAME) + { + do + { + String fn = in.getText(); + in.nextToken(); + if (name.equals(fn)) + { + return null; + } + else + { + if (currentReorderBuffer == null) + { + currentReorderBuffer = new JsonDecoder.ReorderBuffer(); + } + currentReorderBuffer.savedFields.put(fn, getVaueAsTree(in)); + } + } + while (in.getCurrentToken() == JsonToken.FIELD_NAME); + } + } + else if (top == Symbol.FIELD_END) + { + if (currentReorderBuffer != null && currentReorderBuffer.origParser != null) + { + setParser(currentReorderBuffer.origParser); + currentReorderBuffer.origParser = null; + } + } + else if (top == Symbol.RECORD_START) + { + if (in.getCurrentToken() == JsonToken.START_OBJECT) + { + in.nextToken(); + reorderBuffers.push(currentReorderBuffer); + currentReorderBuffer = null; + } + else + { + throw error("record-start"); + } + } + else if (top == Symbol.RECORD_END || top == Symbol.UNION_END) + { + if (in.getCurrentToken() == JsonToken.END_OBJECT) + { + in.nextToken(); + if (top == Symbol.RECORD_END) + { + if (currentReorderBuffer != null && !currentReorderBuffer.savedFields.isEmpty()) + { + throw error("Unknown fields: " + currentReorderBuffer.savedFields.keySet()); + } + currentReorderBuffer = reorderBuffers.pop(); + } + } + else + { + throw error(top == Symbol.RECORD_END ? "record-end" : "union-end"); + } + } + else + { + throw new AvroTypeException("Unknown action symbol " + top); + } + return null; + } + catch (IllegalAccessException ex) + { + throw new RuntimeException(ex); + } + } + + private static final JsonElement NULL_JSON_ELEMENT = new JsonElement(null); + + private JsonParser getParser() throws IllegalAccessException + { + return (JsonParser) IN.get(this); + } + + private void setParser(final JsonParser parser) throws IllegalAccessException + { + IN.set(this, parser); + } +} diff --git a/runtime/model-avro/src/main/java/org/apache/avro/io/JsonDecoder.java b/runtime/model-avro/src/main/java/org/apache/avro/io/JsonDecoder.java new file mode 100644 index 0000000000..37f15568b4 --- /dev/null +++ b/runtime/model-avro/src/main/java/org/apache/avro/io/JsonDecoder.java @@ -0,0 +1,942 @@ +/* + * Copyright 2021-2024 Aklivity Inc + * + * Licensed under the Aklivity Community License (the "License"); you may not use + * this file except in compliance with the License. You may obtain a copy of the + * License at + * + * https://www.aklivity.io/aklivity-community-license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.avro.io; + +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Stack; + +import com.fasterxml.jackson.core.Base64Variant; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonLocation; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonStreamContext; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.core.Version; + +import org.apache.avro.AvroTypeException; +import org.apache.avro.Schema; +import org.apache.avro.io.parsing.JsonGrammarGenerator; +import org.apache.avro.io.parsing.Parser; +import org.apache.avro.io.parsing.Symbol; +import org.apache.avro.util.Utf8; + +/** A {@link Decoder} for Avro's JSON data encoding. + *

+ * Construct using {@link DecoderFactory}. + *

+ * JsonDecoder is not thread-safe. + * */ +public class JsonDecoder extends ParsingDecoder + implements Parser.ActionHandler +{ + private JsonParser in; + private static JsonFactory jsonFactory = new JsonFactory(); + Stack reorderBuffers = new Stack(); + ReorderBuffer currentReorderBuffer; + + static class ReorderBuffer + { + public Map> savedFields = new HashMap>(); + public JsonParser origParser = null; + } + + static final String CHARSET = "ISO-8859-1"; + + private JsonDecoder(Symbol root, InputStream in) throws IOException + { + super(root); + configure(in); + } + + private JsonDecoder(Symbol root, String in) throws IOException + { + super(root); + configure(in); + } + + JsonDecoder(Schema schema, InputStream in) throws IOException + { + this(getSymbol(schema), in); + } + + JsonDecoder(Schema schema, String in) throws IOException + { + this(getSymbol(schema), in); + } + + private static Symbol getSymbol(Schema schema) + { + if (null == schema) + { + throw new NullPointerException("Schema cannot be null!"); + } + return new JsonGrammarGenerator().generate(schema); + } + + /** + * Reconfigures this JsonDecoder to use the InputStream provided. + *

+ * If the InputStream provided is null, a NullPointerException is thrown. + *

+ * Otherwise, this JsonDecoder will reset its state and then + * reconfigure its input. + * @param in + * The IntputStream to read from. Cannot be null. + * @throws IOException + * @return this JsonDecoder + */ + public JsonDecoder configure(InputStream in) throws IOException + { + if (null == in) + { + throw new NullPointerException("InputStream to read from cannot be null!"); + } + parser.reset(); + this.in = jsonFactory.createJsonParser(in); + this.in.nextToken(); + return this; + } + + /** + * Reconfigures this JsonDecoder to use the String provided for input. + *

+ * If the String provided is null, a NullPointerException is thrown. + *

+ * Otherwise, this JsonDecoder will reset its state and then + * reconfigure its input. + * @param in + * The String to read from. Cannot be null. + * @throws IOException + * @return this JsonDecoder + */ + public JsonDecoder configure(String in) throws IOException + { + if (null == in) + { + throw new NullPointerException("String to read from cannot be null!"); + } + parser.reset(); + this.in = new JsonFactory().createJsonParser(in); + this.in.nextToken(); + return this; + } + + private void advance(Symbol symbol) throws IOException + { + this.parser.processTrailingImplicitActions(); + if (in.getCurrentToken() == null && this.parser.depth() == 1) + throw new EOFException(); + parser.advance(symbol); + } + + @Override + public void readNull() throws IOException + { + advance(Symbol.NULL); + if (in.getCurrentToken() == JsonToken.VALUE_NULL) + { + in.nextToken(); + } + else + { + throw error("null"); + } + } + + @Override + public boolean readBoolean() throws IOException + { + advance(Symbol.BOOLEAN); + JsonToken t = in.getCurrentToken(); + if (t == JsonToken.VALUE_TRUE || t == JsonToken.VALUE_FALSE) + { + in.nextToken(); + return t == JsonToken.VALUE_TRUE; + } + else + { + throw error("boolean"); + } + } + + @Override + public int readInt() throws IOException + { + advance(Symbol.INT); + if (in.getCurrentToken().isNumeric()) + { + int result = in.getIntValue(); + in.nextToken(); + return result; + } + else + { + throw error("int"); + } + } + + @Override + public long readLong() throws IOException + { + advance(Symbol.LONG); + if (in.getCurrentToken().isNumeric()) + { + long result = in.getLongValue(); + in.nextToken(); + return result; + } + else + { + throw error("long"); + } + } + + @Override + public float readFloat() throws IOException + { + advance(Symbol.FLOAT); + if (in.getCurrentToken().isNumeric()) + { + float result = in.getFloatValue(); + in.nextToken(); + return result; + } + else + { + throw error("float"); + } + } + + @Override + public double readDouble() throws IOException + { + advance(Symbol.DOUBLE); + if (in.getCurrentToken().isNumeric()) + { + double result = in.getDoubleValue(); + in.nextToken(); + return result; + } + else + { + throw error("double"); + } + } + + @Override + public Utf8 readString(Utf8 old) throws IOException + { + return new Utf8(readString()); + } + + @Override + public String readString() throws IOException + { + advance(Symbol.STRING); + if (parser.topSymbol() == Symbol.MAP_KEY_MARKER) + { + parser.advance(Symbol.MAP_KEY_MARKER); + if (in.getCurrentToken() != JsonToken.FIELD_NAME) + { + throw error("map-key"); + } + } + else + { + if (in.getCurrentToken() != JsonToken.VALUE_STRING) + { + throw error("string"); + } + } + String result = in.getText(); + in.nextToken(); + return result; + } + + @Override + public void skipString() throws IOException + { + advance(Symbol.STRING); + if (parser.topSymbol() == Symbol.MAP_KEY_MARKER) + { + parser.advance(Symbol.MAP_KEY_MARKER); + if (in.getCurrentToken() != JsonToken.FIELD_NAME) + { + throw error("map-key"); + } + } + else + { + if (in.getCurrentToken() != JsonToken.VALUE_STRING) + { + throw error("string"); + } + } + in.nextToken(); + } + + @Override + public ByteBuffer readBytes(ByteBuffer old) throws IOException + { + advance(Symbol.BYTES); + if (in.getCurrentToken() == JsonToken.VALUE_STRING) + { + byte[] result = readByteArray(); + in.nextToken(); + return ByteBuffer.wrap(result); + } + else + { + throw error("bytes"); + } + } + + private byte[] readByteArray() throws IOException + { + byte[] result = in.getText().getBytes(CHARSET); + return result; + } + + @Override + public void skipBytes() throws IOException + { + advance(Symbol.BYTES); + if (in.getCurrentToken() == JsonToken.VALUE_STRING) + { + in.nextToken(); + } + else + { + throw error("bytes"); + } + } + + private void checkFixed(int size) throws IOException + { + advance(Symbol.FIXED); + Symbol.IntCheckAction top = (Symbol.IntCheckAction) parser.popSymbol(); + if (size != top.size) + { + throw new AvroTypeException( + "Incorrect length for fixed binary: expected " + + top.size + " but received " + size + " bytes."); + } + } + + @Override + public void readFixed(byte[] bytes, int start, int len) throws IOException + { + checkFixed(len); + if (in.getCurrentToken() == JsonToken.VALUE_STRING) + { + byte[] result = readByteArray(); + in.nextToken(); + if (result.length != len) + { + throw new AvroTypeException("Expected fixed length " + len + + ", but got" + result.length); + } + System.arraycopy(result, 0, bytes, start, len); + } + else + { + throw error("fixed"); + } + } + + @Override + public void skipFixed(int length) throws IOException + { + checkFixed(length); + doSkipFixed(length); + } + + private void doSkipFixed(int length) throws IOException + { + if (in.getCurrentToken() == JsonToken.VALUE_STRING) + { + byte[] result = readByteArray(); + in.nextToken(); + if (result.length != length) + { + throw new AvroTypeException("Expected fixed length " + length + + ", but got" + result.length); + } + } + else + { + throw error("fixed"); + } + } + + @Override + protected void skipFixed() throws IOException + { + advance(Symbol.FIXED); + Symbol.IntCheckAction top = (Symbol.IntCheckAction) parser.popSymbol(); + doSkipFixed(top.size); + } + + @Override + public int readEnum() throws IOException + { + advance(Symbol.ENUM); + Symbol.EnumLabelsAction top = (Symbol.EnumLabelsAction) parser.popSymbol(); + if (in.getCurrentToken() == JsonToken.VALUE_STRING) + { + in.getText(); + int n = top.findLabel(in.getText()); + if (n >= 0) + { + in.nextToken(); + return n; + } + throw new AvroTypeException("Unknown symbol in enum " + in.getText()); + } + else + { + throw error("fixed"); + } + } + + @Override + public long readArrayStart() throws IOException + { + advance(Symbol.ARRAY_START); + if (in.getCurrentToken() == JsonToken.START_ARRAY) + { + in.nextToken(); + return doArrayNext(); + } + else + { + throw error("array-start"); + } + } + + @Override + public long arrayNext() throws IOException + { + advance(Symbol.ITEM_END); + return doArrayNext(); + } + + private long doArrayNext() throws IOException + { + if (in.getCurrentToken() == JsonToken.END_ARRAY) + { + parser.advance(Symbol.ARRAY_END); + in.nextToken(); + return 0; + } + else + { + return 1; + } + } + + @Override + public long skipArray() throws IOException + { + advance(Symbol.ARRAY_START); + if (in.getCurrentToken() == JsonToken.START_ARRAY) + { + in.skipChildren(); + in.nextToken(); + advance(Symbol.ARRAY_END); + } + else + { + throw error("array-start"); + } + return 0; + } + + @Override + public long readMapStart() throws IOException + { + advance(Symbol.MAP_START); + if (in.getCurrentToken() == JsonToken.START_OBJECT) + { + in.nextToken(); + return doMapNext(); + } + else + { + throw error("map-start"); + } + } + + @Override + public long mapNext() throws IOException + { + advance(Symbol.ITEM_END); + return doMapNext(); + } + + private long doMapNext() throws IOException + { + if (in.getCurrentToken() == JsonToken.END_OBJECT) + { + in.nextToken(); + advance(Symbol.MAP_END); + return 0; + } + else + { + return 1; + } + } + + @Override + public long skipMap() throws IOException + { + advance(Symbol.MAP_START); + if (in.getCurrentToken() == JsonToken.START_OBJECT) + { + in.skipChildren(); + in.nextToken(); + advance(Symbol.MAP_END); + } + else + { + throw error("map-start"); + } + return 0; + } + + @Override + public int readIndex() throws IOException + { + advance(Symbol.UNION); + Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); + + String label; + if (in.getCurrentToken() == JsonToken.VALUE_NULL) + { + label = "null"; + } + else if (in.getCurrentToken() == JsonToken.START_OBJECT && + in.nextToken() == JsonToken.FIELD_NAME) + { + label = in.getText(); + in.nextToken(); + parser.pushSymbol(Symbol.UNION_END); + } + else + { + throw error("start-union"); + } + int n = a.findLabel(label); + if (n < 0) + throw new AvroTypeException("Unknown union branch " + label); + parser.pushSymbol(a.getSymbol(n)); + return n; + } + + @Override + public Symbol doAction(Symbol input, Symbol top) throws IOException + { + if (top instanceof Symbol.FieldAdjustAction) + { + Symbol.FieldAdjustAction fa = (Symbol.FieldAdjustAction) top; + String name = fa.fname; + if (currentReorderBuffer != null) + { + List node = currentReorderBuffer.savedFields.get(name); + if (node != null) + { + currentReorderBuffer.savedFields.remove(name); + currentReorderBuffer.origParser = in; + in = makeParser(node); + return null; + } + } + if (in.getCurrentToken() == JsonToken.FIELD_NAME) + { + do + { + String fn = in.getText(); + in.nextToken(); + if (name.equals(fn)) + { + return null; + } + else + { + if (currentReorderBuffer == null) + { + currentReorderBuffer = new ReorderBuffer(); + } + currentReorderBuffer.savedFields.put(fn, getVaueAsTree(in)); + } + } + while (in.getCurrentToken() == JsonToken.FIELD_NAME); + throw new AvroTypeException("Expected field name not found: " + fa.fname); + } + } + else if (top == Symbol.FIELD_END) + { + if (currentReorderBuffer != null && currentReorderBuffer.origParser != null) + { + in = currentReorderBuffer.origParser; + currentReorderBuffer.origParser = null; + } + } + else if (top == Symbol.RECORD_START) + { + if (in.getCurrentToken() == JsonToken.START_OBJECT) + { + in.nextToken(); + reorderBuffers.push(currentReorderBuffer); + currentReorderBuffer = null; + } + else + { + throw error("record-start"); + } + } + else if (top == Symbol.RECORD_END || top == Symbol.UNION_END) + { + if (in.getCurrentToken() == JsonToken.END_OBJECT) + { + in.nextToken(); + if (top == Symbol.RECORD_END) + { + if (currentReorderBuffer != null && !currentReorderBuffer.savedFields.isEmpty()) + { + throw error("Unknown fields: " + currentReorderBuffer.savedFields.keySet()); + } + currentReorderBuffer = reorderBuffers.pop(); + } + } + else + { + throw error(top == Symbol.RECORD_END ? "record-end" : "union-end"); + } + } + else + { + throw new AvroTypeException("Unknown action symbol " + top); + } + return null; + } + + static class JsonElement + { + public final JsonToken token; + public final String value; + + public JsonElement(JsonToken t, String value) + { + this.token = t; + this.value = value; + } + + public JsonElement(JsonToken t) + { + this(t, null); + } + } + + static List getVaueAsTree(JsonParser in) throws IOException + { + int level = 0; + List result = new ArrayList(); + do + { + JsonToken t = in.getCurrentToken(); + switch (t) + { + case START_OBJECT: + case START_ARRAY: + level++; + result.add(new JsonElement(t)); + break; + case END_OBJECT: + case END_ARRAY: + level--; + result.add(new JsonElement(t)); + break; + case FIELD_NAME: + case VALUE_STRING: + case VALUE_NUMBER_INT: + case VALUE_NUMBER_FLOAT: + case VALUE_TRUE: + case VALUE_FALSE: + case VALUE_NULL: + result.add(new JsonElement(t, in.getText())); + break; + } + in.nextToken(); + } + while (level != 0); + result.add(new JsonElement(null)); + return result; + } + + JsonParser makeParser(final List elements) throws IOException + { + return new JsonParser() + { + int pos = 0; + + @Override + public JsonToken nextValue() throws IOException + { + throw new UnsupportedOperationException(); + }; + + @Override + public ObjectCodec getCodec() + { + throw new UnsupportedOperationException(); + } + + @Override + public void setCodec(ObjectCodec c) + { + throw new UnsupportedOperationException(); + } + + @Override + public void close() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public JsonToken nextToken() throws IOException + { + pos++; + return elements.get(pos).token; + } + + @Override + public JsonParser skipChildren() throws IOException + { + int level = 0; + do + { + switch (elements.get(pos++).token) + { + case START_ARRAY: + case START_OBJECT: + level++; + break; + case END_ARRAY: + case END_OBJECT: + level--; + break; + } + } + while (level > 0); + return this; + } + + @Override + public boolean isClosed() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getCurrentName() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public JsonStreamContext getParsingContext() + { + throw new UnsupportedOperationException(); + } + + @Override + public JsonLocation getTokenLocation() + { + throw new UnsupportedOperationException(); + } + + @Override + public JsonLocation getCurrentLocation() + { + throw new UnsupportedOperationException(); + } + + @Override + public String getText() throws IOException + { + return elements.get(pos).value; + } + + @Override + public char[] getTextCharacters() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public int getTextLength() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public int getTextOffset() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public boolean hasTextCharacters() + { + return false; + } + + @Override + public Number getNumberValue() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public NumberType getNumberType() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public int getIntValue() throws IOException + { + return Integer.parseInt(getText()); + } + + @Override + public long getLongValue() throws IOException + { + return Long.parseLong(getText()); + } + + @Override + public BigInteger getBigIntegerValue() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public float getFloatValue() throws IOException + { + return Float.parseFloat(getText()); + } + + @Override + public double getDoubleValue() throws IOException + { + return Double.parseDouble(getText()); + } + + @Override + public BigDecimal getDecimalValue() throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public byte[] getBinaryValue(Base64Variant b64variant) + throws IOException + { + throw new UnsupportedOperationException(); + } + + @Override + public String getValueAsString(String s) throws IOException + { + return ""; + } + + @Override + public JsonToken getCurrentToken() + { + return elements.get(pos).token; + } + + @Override + public int getCurrentTokenId() + { + return 0; + } + + @Override + public boolean hasCurrentToken() + { + return false; + } + + @Override + public boolean hasTokenId(int i) + { + return false; + } + + @Override + public boolean hasToken(JsonToken jsonToken) + { + return false; + } + + @Override + public void clearCurrentToken() + { + + } + + @Override + public JsonToken getLastClearedToken() + { + return null; + } + + @Override + public void overrideCurrentName(String s) + { + + } + + @Override + public Version version() + { + throw new UnsupportedOperationException(); + } + }; + } + + AvroTypeException error(String type) + { + return new AvroTypeException("Expected " + type + + ". Got " + in.getCurrentToken()); + } + +} diff --git a/runtime/model-avro/src/main/zilla/internal.idl b/runtime/model-avro/src/main/zilla/internal.idl index 62ca4e050f..0a7de462f3 100644 --- a/runtime/model-avro/src/main/zilla/internal.idl +++ b/runtime/model-avro/src/main/zilla/internal.idl @@ -44,4 +44,9 @@ scope internal { octets[1] value; } + + struct AvroUnion + { + varint32 index; + } } diff --git a/runtime/model-core/pom.xml b/runtime/model-core/pom.xml index 4300e67133..340ca81c72 100644 --- a/runtime/model-core/pom.xml +++ b/runtime/model-core/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/model-json/pom.xml b/runtime/model-json/pom.xml index 357a4852d8..a4ad76b89d 100644 --- a/runtime/model-json/pom.xml +++ b/runtime/model-json/pom.xml @@ -6,7 +6,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/model-protobuf/pom.xml b/runtime/model-protobuf/pom.xml index 215f80e173..9e7af75a60 100644 --- a/runtime/model-protobuf/pom.xml +++ b/runtime/model-protobuf/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/pom.xml b/runtime/pom.xml index d36402132c..ef2b0c925c 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla zilla - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/resolver-env/pom.xml b/runtime/resolver-env/pom.xml index 01d839777d..b96f166128 100644 --- a/runtime/resolver-env/pom.xml +++ b/runtime/resolver-env/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/runtime/vault-filesystem/pom.xml b/runtime/vault-filesystem/pom.xml index f4a222c063..b010232255 100644 --- a/runtime/vault-filesystem/pom.xml +++ b/runtime/vault-filesystem/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla runtime - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-asyncapi.spec/pom.xml b/specs/binding-asyncapi.spec/pom.xml index 909eaaf179..e80fb38e72 100644 --- a/specs/binding-asyncapi.spec/pom.xml +++ b/specs/binding-asyncapi.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-echo.spec/pom.xml b/specs/binding-echo.spec/pom.xml index 0b22cdd56a..27e6f2e656 100644 --- a/specs/binding-echo.spec/pom.xml +++ b/specs/binding-echo.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-fan.spec/pom.xml b/specs/binding-fan.spec/pom.xml index 6416f9cc14..f12b48a7cb 100644 --- a/specs/binding-fan.spec/pom.xml +++ b/specs/binding-fan.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-filesystem.spec/pom.xml b/specs/binding-filesystem.spec/pom.xml index 6097a83668..d1dc191546 100644 --- a/specs/binding-filesystem.spec/pom.xml +++ b/specs/binding-filesystem.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-grpc-kafka.spec/pom.xml b/specs/binding-grpc-kafka.spec/pom.xml index df072fd920..be971e088d 100644 --- a/specs/binding-grpc-kafka.spec/pom.xml +++ b/specs/binding-grpc-kafka.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-grpc.spec/pom.xml b/specs/binding-grpc.spec/pom.xml index ae11ce5963..dd1b8d6869 100644 --- a/specs/binding-grpc.spec/pom.xml +++ b/specs/binding-grpc.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-http-filesystem.spec/pom.xml b/specs/binding-http-filesystem.spec/pom.xml index fbf327340b..85c0c080d2 100644 --- a/specs/binding-http-filesystem.spec/pom.xml +++ b/specs/binding-http-filesystem.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-http-kafka.spec/pom.xml b/specs/binding-http-kafka.spec/pom.xml index bba2317b8a..c57549f16f 100644 --- a/specs/binding-http-kafka.spec/pom.xml +++ b/specs/binding-http-kafka.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-http.spec/pom.xml b/specs/binding-http.spec/pom.xml index 613ff2fabc..644079a74f 100644 --- a/specs/binding-http.spec/pom.xml +++ b/specs/binding-http.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-kafka-grpc.spec/pom.xml b/specs/binding-kafka-grpc.spec/pom.xml index 025b575590..e81556121c 100644 --- a/specs/binding-kafka-grpc.spec/pom.xml +++ b/specs/binding-kafka-grpc.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-kafka.spec/pom.xml b/specs/binding-kafka.spec/pom.xml index 8a7feb326e..ed8b0bb8e6 100644 --- a/specs/binding-kafka.spec/pom.xml +++ b/specs/binding-kafka.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-mqtt-kafka.spec/pom.xml b/specs/binding-mqtt-kafka.spec/pom.xml index 964df4f1b5..da1c52cee2 100644 --- a/specs/binding-mqtt-kafka.spec/pom.xml +++ b/specs/binding-mqtt-kafka.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-mqtt.spec/pom.xml b/specs/binding-mqtt.spec/pom.xml index 5faa901a24..95bf03f03b 100644 --- a/specs/binding-mqtt.spec/pom.xml +++ b/specs/binding-mqtt.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-openapi-asyncapi.spec/pom.xml b/specs/binding-openapi-asyncapi.spec/pom.xml index 095bb97e11..d5b0d739a8 100644 --- a/specs/binding-openapi-asyncapi.spec/pom.xml +++ b/specs/binding-openapi-asyncapi.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-openapi.spec/pom.xml b/specs/binding-openapi.spec/pom.xml index 87bb8cc291..ede504581f 100644 --- a/specs/binding-openapi.spec/pom.xml +++ b/specs/binding-openapi.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-proxy.spec/pom.xml b/specs/binding-proxy.spec/pom.xml index d2c80e9cf6..7bea854400 100644 --- a/specs/binding-proxy.spec/pom.xml +++ b/specs/binding-proxy.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-sse-kafka.spec/pom.xml b/specs/binding-sse-kafka.spec/pom.xml index 9731692a5d..d67e77e853 100644 --- a/specs/binding-sse-kafka.spec/pom.xml +++ b/specs/binding-sse-kafka.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-sse.spec/pom.xml b/specs/binding-sse.spec/pom.xml index 1b1487377b..41cb5f84aa 100644 --- a/specs/binding-sse.spec/pom.xml +++ b/specs/binding-sse.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-tcp.spec/pom.xml b/specs/binding-tcp.spec/pom.xml index 700ddf7090..fe0ab745cd 100644 --- a/specs/binding-tcp.spec/pom.xml +++ b/specs/binding-tcp.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-tls.spec/pom.xml b/specs/binding-tls.spec/pom.xml index a0e7bf329c..2e07c34ae3 100644 --- a/specs/binding-tls.spec/pom.xml +++ b/specs/binding-tls.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/binding-ws.spec/pom.xml b/specs/binding-ws.spec/pom.xml index 73181cc2e8..a05f97119e 100644 --- a/specs/binding-ws.spec/pom.xml +++ b/specs/binding-ws.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/catalog-apicurio.spec/pom.xml b/specs/catalog-apicurio.spec/pom.xml index f03488b861..e63b9c71a0 100644 --- a/specs/catalog-apicurio.spec/pom.xml +++ b/specs/catalog-apicurio.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/catalog-filesystem.spec/pom.xml b/specs/catalog-filesystem.spec/pom.xml index 6801969ec7..c7e13979e8 100644 --- a/specs/catalog-filesystem.spec/pom.xml +++ b/specs/catalog-filesystem.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/catalog-inline.spec/pom.xml b/specs/catalog-inline.spec/pom.xml index 209f4c5d28..6af61943b2 100644 --- a/specs/catalog-inline.spec/pom.xml +++ b/specs/catalog-inline.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/catalog-karapace.spec/pom.xml b/specs/catalog-karapace.spec/pom.xml index 696e309c7d..beff1d7f11 100644 --- a/specs/catalog-karapace.spec/pom.xml +++ b/specs/catalog-karapace.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/catalog-schema-registry.spec/pom.xml b/specs/catalog-schema-registry.spec/pom.xml index e2ac1d0f49..8d402d5298 100644 --- a/specs/catalog-schema-registry.spec/pom.xml +++ b/specs/catalog-schema-registry.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/engine.spec/pom.xml b/specs/engine.spec/pom.xml index 32f37ebfe5..c9e95fd4d4 100644 --- a/specs/engine.spec/pom.xml +++ b/specs/engine.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/exporter-otlp.spec/pom.xml b/specs/exporter-otlp.spec/pom.xml index bd024bb602..39291e1900 100644 --- a/specs/exporter-otlp.spec/pom.xml +++ b/specs/exporter-otlp.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/exporter-prometheus.spec/pom.xml b/specs/exporter-prometheus.spec/pom.xml index 409776dce3..1a4cee9ea9 100644 --- a/specs/exporter-prometheus.spec/pom.xml +++ b/specs/exporter-prometheus.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/exporter-stdout.spec/pom.xml b/specs/exporter-stdout.spec/pom.xml index 18cac80137..003740869b 100644 --- a/specs/exporter-stdout.spec/pom.xml +++ b/specs/exporter-stdout.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/filesystem-http.spec/pom.xml b/specs/filesystem-http.spec/pom.xml index bcde304297..b1400bb163 100644 --- a/specs/filesystem-http.spec/pom.xml +++ b/specs/filesystem-http.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/guard-jwt.spec/pom.xml b/specs/guard-jwt.spec/pom.xml index bde70b8af8..344d4b53c0 100644 --- a/specs/guard-jwt.spec/pom.xml +++ b/specs/guard-jwt.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/metrics-grpc.spec/pom.xml b/specs/metrics-grpc.spec/pom.xml index aea214c6d2..6577698249 100644 --- a/specs/metrics-grpc.spec/pom.xml +++ b/specs/metrics-grpc.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/metrics-http.spec/pom.xml b/specs/metrics-http.spec/pom.xml index f3616e0bce..e2470e8ff7 100644 --- a/specs/metrics-http.spec/pom.xml +++ b/specs/metrics-http.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/metrics-stream.spec/pom.xml b/specs/metrics-stream.spec/pom.xml index 5096356d6f..bf1aef48da 100644 --- a/specs/metrics-stream.spec/pom.xml +++ b/specs/metrics-stream.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/model-avro.spec/pom.xml b/specs/model-avro.spec/pom.xml index 0b5432e526..bbc84f1555 100644 --- a/specs/model-avro.spec/pom.xml +++ b/specs/model-avro.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/model-core.spec/pom.xml b/specs/model-core.spec/pom.xml index 1d75968fd9..38dabd537c 100644 --- a/specs/model-core.spec/pom.xml +++ b/specs/model-core.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/model-json.spec/pom.xml b/specs/model-json.spec/pom.xml index 13d6d689fe..39d6af9983 100644 --- a/specs/model-json.spec/pom.xml +++ b/specs/model-json.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/model-protobuf.spec/pom.xml b/specs/model-protobuf.spec/pom.xml index 9ba99e9978..1f3e923b92 100644 --- a/specs/model-protobuf.spec/pom.xml +++ b/specs/model-protobuf.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/pom.xml b/specs/pom.xml index 13f5e045bb..3d255eb98a 100644 --- a/specs/pom.xml +++ b/specs/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla zilla - 0.9.104 + 0.9.105 ../pom.xml diff --git a/specs/vault-filesystem.spec/pom.xml b/specs/vault-filesystem.spec/pom.xml index 632d236e56..a9e9d58c5a 100644 --- a/specs/vault-filesystem.spec/pom.xml +++ b/specs/vault-filesystem.spec/pom.xml @@ -8,7 +8,7 @@ io.aklivity.zilla specs - 0.9.104 + 0.9.105 ../pom.xml