diff --git a/kafka/src/main/java/io/specmesh/kafka/provision/schema/SchemaReaders.java b/kafka/src/main/java/io/specmesh/kafka/provision/schema/SchemaReaders.java index ffbc72ed..a5fee1f2 100644 --- a/kafka/src/main/java/io/specmesh/kafka/provision/schema/SchemaReaders.java +++ b/kafka/src/main/java/io/specmesh/kafka/provision/schema/SchemaReaders.java @@ -16,6 +16,7 @@ package io.specmesh.kafka.provision.schema; +import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -47,6 +48,11 @@ /** Readers for reading Schemas */ public final class SchemaReaders { + private static final ObjectMapper objectMapper = new ObjectMapper(); + + static { + objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true); + } /** defensive */ private SchemaReaders() {} @@ -99,8 +105,7 @@ private SchemaReferences resolveReferencesFor( final String filePath, final String schemaContent) { try { final SchemaReferences results = new SchemaReferences(); - final var refs = - findJsonNodes(new ObjectMapper().readTree(schemaContent), "subject"); + final var refs = findJsonNodes(objectMapper.readTree(schemaContent), "subject"); final var parent = new File(filePath).getParent(); refs.forEach(ref -> results.add(parent, ref)); return results; diff --git a/kafka/src/test/resources/schema-ref/schema/com.example.trading.Trade.avsc b/kafka/src/test/resources/schema-ref/schema/com.example.trading.Trade.avsc index 365451d0..9dff5db2 100644 --- a/kafka/src/test/resources/schema-ref/schema/com.example.trading.Trade.avsc +++ b/kafka/src/test/resources/schema-ref/schema/com.example.trading.Trade.avsc @@ -13,6 +13,7 @@ { "name": "detail", "type": "string", "doc": "Trade details." }, +// some comment - works { "name": "currency", "type": "com.example.shared.Currency",