Open visortelle opened 1 year ago
The current implementation checks only for changing a root message name.
https://github.com/apache/pulsar/blob/34c18704ce759922ce45820321af44b382a28e10/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/ProtobufNativeSchemaCompatibilityCheck.java#L67-L72
It's definitely not enough. For example, these schemas won't be compatible due to the changed field type:
message Person { int32 age = 1; string name = 2; }
message Person { int64 age = 1; string name = 2;
Of course, it's the simplest case. There are many more of them.
PROTOBUF_NATIVE
Implement it in Java on your own. 👍
Probably take buf.build rules is a good point to start. https://github.com/bufbuild/buf/blob/8b53bf721f3e21eedc3aef3eb0730fdf56d38064/private/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/bufbreakingcheck.go#L338
I understand why it has been implemented this way. By quick googling, I didn't find any ready-to-use JVM-based Protobuf compatibility checkers.
In comparison, Avro has the org.apache.avro.SchemaValidator package.
org.apache.avro.SchemaValidator
Maybe I can give it a try.
The issue had no activity for 30 days, mark with Stale label.
Search before asking
Motivation
The current implementation checks only for changing a root message name.
https://github.com/apache/pulsar/blob/34c18704ce759922ce45820321af44b382a28e10/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/ProtobufNativeSchemaCompatibilityCheck.java#L67-L72
It's definitely not enough. For example, these schemas won't be compatible due to the changed field type:
Of course, it's the simplest case. There are many more of them.
Solution
PROTOBUF_NATIVE
schema type. 👎Implement it in Java on your own. 👍
Probably take buf.build rules is a good point to start. https://github.com/bufbuild/buf/blob/8b53bf721f3e21eedc3aef3eb0730fdf56d38064/private/bufpkg/bufcheck/bufbreaking/internal/bufbreakingcheck/bufbreakingcheck.go#L338
Alternatives
Anything else?
I understand why it has been implemented this way. By quick googling, I didn't find any ready-to-use JVM-based Protobuf compatibility checkers.
In comparison, Avro has the
org.apache.avro.SchemaValidator
package.Are you willing to submit a PR?