gnodet-bot commented on code in PR #30650:
URL: https://github.com/apache/camel/pull/30650#discussion_r4664192503
##########
components/camel-kafka/src/main/docs/kafka-component.adoc:
##########
@@ -993,12 +993,13 @@ The `schemaRegistryURL` option is set as the registry URL
of the vendor.
|===
| schemaRegistryVendor | schemaFormat | What Camel sets
| confluent | avro, json, protobuf | The `KafkaAvroSerializer`,
`KafkaJsonSchemaSerializer` or `KafkaProtobufSerializer` (and the matching
deserializer) of Confluent, and `schema.registry.url`. The producer registers
the schemas (the Confluent default). Several registries implement the Confluent
registry API, such as Karapace, the Redpanda schema registry and the Confluent
compatible API of Apicurio Registry, so `confluent` works for them too.
-| apicurio | avro, json, protobuf | The `AvroKafkaSerializer`,
`JsonSchemaKafkaSerializer` or `ProtobufKafkaSerializer` (and the matching
deserializer) of Apicurio Registry 3.x, `apicurio.registry.url`, and on the
producer `apicurio.registry.auto-register=true`.
+| apicurio | avro, json, protobuf | The `AvroKafkaSerializer`,
`JsonSchemaKafkaSerializer` or `ProtobufKafkaSerializer` (and the matching
deserializer) of Apicurio Registry 3.x, `apicurio.registry.url`, and on the
producer `apicurio.registry.auto-register=true`. JSON Schema
(`schemaFormat=json`) fails at startup when
`com.networknt:json-schema-validator` 3.x is on the classpath (see below).
| aws-glue | avro, json, protobuf | The `GlueSchemaRegistryKafkaSerializer`
and `GlueSchemaRegistryKafkaDeserializer`, `dataFormat`, on the producer
`schemaAutoRegistrationEnabled=true`, and on the consumer of Avro
`avroRecordType=GENERIC_RECORD`. The `schemaRegistryURL` is optional and is set
as `endpoint` (to override the endpoint of the Glue service).
| azure | avro | The `KafkaAvroSerializer` and `KafkaAvroDeserializer` of the
Azure Schema Registry, `schema.registry.url` (the fully qualified namespace of
the Event Hubs namespace), `use.azure.credential=true`, and on the producer
`auto.register.schemas=true`.
Review Comment:
💡 **Low — Plain text cross-reference:** The text ends with `(see below)` but
there is no AsciiDoc anchor or `<<xref>>` target defined for the section it
refers to. Consider replacing it with an explicit cross-reference, e.g.
`<<apicurio-json-incompatibility,see below>>` with a matching
`[[apicurio-json-incompatibility]]` anchor on the note block, so the reference
is navigable in the rendered HTML docs.
##########
components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaSchemaRegistryVendorTest.java:
##########
@@ -500,6 +496,26 @@ void azureSupportsOnlyAvro() {
}
}
+ @Test
+ void apicurioWithJsonFailsWhenJsonSchemaValidator3xIsOnTheClasspath() {
+ // The test classpath includes camel-kafka (via transitive deps) which
pulls in json-schema-validator 3.x,
+ // so hasJsonSchemaValidator3x() returns true and the check rejects
the combination.
+ // An application without camel-yaml-dsl-validator,
camel-json-validator or Camel JBang would have
+ // only the 1.5.x that the Apicurio serde brings, and the check would
not trigger.
+ assumeTrue(KafkaSchemaRegistry.hasJsonSchemaValidator3x(),
+ "json-schema-validator 3.x is not on the classpath;
apicurio+json is not rejected");
Review Comment:
💡 **Medium — Silent test assumption:**
`assumeTrue(KafkaSchemaRegistry.hasJsonSchemaValidator3x(), ...)` means this
test becomes a no-op silently if the `json-schema-validator` 3.x transitive
dependency is ever removed or excluded from the test classpath — leaving the
validation path completely uncovered with no failure signal.
Consider adding a companion test for the negative case (3.x absent →
`vendor(apicurio, json)` succeeds, i.e. no `IllegalArgumentException` is
thrown), so that if the guard condition is never true, CI will still verify the
happy-path contract.
##########
components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaSchemaRegistryVendorTest.java:
##########
@@ -536,6 +552,20 @@ void producerFailsToStartForAnUnsupportedCombination()
throws Exception {
} finally {
producer.stop();
}
+
+ if (KafkaSchemaRegistry.hasJsonSchemaValidator3x()) {
+ KafkaEndpoint endpoint2 = context.getEndpoint(
Review Comment:
💡 **Low — Inconsistent guard pattern:** This block uses an inline `if
(KafkaSchemaRegistry.hasJsonSchemaValidator3x())` to guard the apicurio+json
sub-case, while the dedicated
`apicurioWithJsonFailsWhenJsonSchemaValidator3xIsOnTheClasspath()` test above
uses `assumeTrue` for the same condition.
Using `if` here is semantically correct (it guards only a subsection of a
multi-case test), but the inconsistency may cause confusion. A brief comment
explaining why `if` is intentional here rather than `assumeTrue` would help
future readers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]