From d9490e1ee7134a392de2f9719c3cafb441398fd3 Mon Sep 17 00:00:00 2001 From: Carles Arnal Date: Wed, 13 Dec 2023 19:34:56 +0100 Subject: [PATCH] Make the json schema extension use mandatory when the serialization classes are present --- .../src/main/java/io/quarkus/deployment/Capability.java | 1 + .../quarkus/kafka/client/deployment/KafkaProcessor.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/Capability.java b/core/deployment/src/main/java/io/quarkus/deployment/Capability.java index 6afbe631768b1..6cd1937771799 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/Capability.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/Capability.java @@ -130,6 +130,7 @@ public interface Capability { String APICURIO_REGISTRY = QUARKUS_PREFIX + ".apicurio.registry"; String APICURIO_REGISTRY_AVRO = APICURIO_REGISTRY + ".avro"; + String APICURIO_REGISTRY_JSON_SCHEMA = APICURIO_REGISTRY + ".json"; String CONFLUENT_REGISTRY = QUARKUS_PREFIX + ".confluent.registry"; String CONFLUENT_REGISTRY_AVRO = CONFLUENT_REGISTRY + ".avro"; diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index 37ea59286d602..3a574b4424f85 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -356,12 +356,19 @@ private void handleAvro(BuildProducer reflectiveClass, "java.lang.AutoCloseable")); } - // --- Apicurio Registry 2.x --- + // --- Apicurio Registry 2.x Avro --- if (QuarkusClassLoader.isClassPresentAtRuntime("io.apicurio.registry.serde.avro.AvroKafkaDeserializer") && !capabilities.isPresent(Capability.APICURIO_REGISTRY_AVRO)) { throw new RuntimeException( "Apicurio Registry 2.x Avro classes detected, please use the quarkus-apicurio-registry-avro extension"); } + + // --- Apicurio Registry 2.x Json Schema --- + if (QuarkusClassLoader.isClassPresentAtRuntime("io.apicurio.registry.serde.avro.JsonKafkaDeserializer") + && !capabilities.isPresent(Capability.APICURIO_REGISTRY_JSON_SCHEMA)) { + throw new RuntimeException( + "Apicurio Registry 2.x Json classes detected, please use the quarkus-apicurio-registry-json extension"); + } } @BuildStep