pulsar-client-go icon indicating copy to clipboard operation
pulsar-client-go copied to clipboard

`NewProtoSchema` is initialized as AvroSchema

Open 0asys opened this issue 3 years ago • 2 comments

Expected behavior

When using NewProtoSchema a protobuf schema for the schema registry in pulsar is expected. Besides that, what is here the desired format in the registry when schema type is PROTOBUF ?

Actual behavior

When using NewProtoSchema

https://github.com/apache/pulsar-client-go/blob/128d8ea3e24035a49fc81a516b01bc57b654a64a/pulsar/schema.go#L129

its initialized as avro schema under the hood and given schema is expected to be in an avro format.

Therefore the PROTOBUF schema type is kind of pointless at the moment and the Avro schema type could be used instead?

Steps to reproduce

producer, err := client.CreateProducer(pulsar.ProducerOptions{
		Topic:  "test",
		Schema: pulsar.NewProtoSchema(schema, nil)
})

schema is expected to have an avro format.

System configuration

Pulsar version: 2.9.1

0asys avatar Feb 25 '22 16:02 0asys

Hey @bpereto, have you found a way to work around this? I just found the same thing and am wondering how I should convert the struct that represents the protobuf into an Avro schema. It doesn't seem very easy to do that in golang.

hunter2046 avatar Sep 29 '22 08:09 hunter2046

Hi @hunter2046

Nothing new, I don't use the schema registry or validation at the moment.

0asys avatar Oct 05 '22 19:10 0asys