Schema-registry: Issues matching on "avro.java.string" : "String" (version 6.0.0)

Created on 5 Nov 2020  路  2Comments  路  Source: confluentinc/schema-registry

I was running schema-registry 5.0 and ran into an issue as referenced at: #868

As per the discussion in using registry in production I'm pre-publishing my schemas so the schema has a field that looks like:

 "type" : [ "null", "string" ],

When I run my producer its connecting to schema registry, generating a reflection based schema on the class it wants to send then using the client to validate the reflected schema against what is in the registry.

image

Its failing because the reflection based schema looks like this:

   "type" : [ "null", {
      "type" : "string",
      "avro.java.string" : "String"
    } ],

So as per the resolution presented in the other issue:

This is addressed in 5.5.1 and later by specifying auto.register.schemas=false and use.latest.version=true in the Avro serializer configs.

I've upgraded to schema registry 6.0.0 and I appear I'm still having the issues.

Here is what my configs look like:

image

Here is a snippet of my application.yml

spring
  cloud:
    schemaRegistryClient: # This is required for the schema registry stuff to work correctly
      endpoint: ${schema-registry}
    stream:
      schemaRegistryClient:
        cached: true
      default:
        group: ${consumer_id}
        producer.useNativeEncoding: true
        consumer.useNativeEncoding: true
      kafka:
        binder:
          autoCreateTopics: false
          producer-properties:
            auto.register.schemas: false

            use.latest.version: true # see: https://github.com/confluentinc/schema-registry/issues/868
            schema.registry.url: ${schema_registry}
            schema.reflection: true # This will allow it to generate a schema from a java class to verify against the registry
            key.serializer: org.apache.kafka.common.serialization.StringSerializer

            # Record name serializer throwing issues
            value.subject.name.strategy: io.confluent.kafka.serializers.subject.RecordNameStrategy
            value.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer

I'd prefer not to go back and modify all the .avsc files to make this work as it appears from a previous issue #868 it should be fixed.

Am I missing something or is this bug still on-going?

Thanks!

Most helpful comment

By the palm to my face I did not!

Thanks!

implementation "io.confluent:kafka-avro-serializer:5.5.1"
implementation "io.confluent:kafka-schema-registry-client:5.5.1"

All 2 comments

Did you upgrade the schema registry client as well?

By the palm to my face I did not!

Thanks!

implementation "io.confluent:kafka-avro-serializer:5.5.1"
implementation "io.confluent:kafka-schema-registry-client:5.5.1"
Was this page helpful?
0 / 5 - 0 ratings