apicurio-registry
apicurio-registry copied to clipboard
protobuf 3 forward compatibility
If I enable forward compatibility and add a new field I would expect it to pass forward compatibility checks, but instead it fails, I can provide a reproducer if that is helpful
Reproducers are always helpful! Thanks.
before.proto
syntax = "proto3";
package com.example;
message Person {
int32 id = 1;
string firstName = 2;
string lastName = 3;
}
after.proto
syntax = "proto3";
package com.example;
message Person {
int32 id = 1;
string firstName = 2;
string lastName = 3;
int32 addressId = 4;
}
UserPropsTest.java
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.junit.jupiter.api.Test;
import io.apicurio.registry.protobuf.ProtobufDifference;
import io.apicurio.registry.rules.compatibility.protobuf.ProtobufCompatibilityCheckerLibrary;
import io.apicurio.registry.utils.protobuf.schema.ProtobufFile;
public class UserPropsTest {
@Test
public void testForward() throws IOException {
ProtobufFile before = new ProtobufFile(new File(UserPropsTest.class.getResource("before.proto").getFile()));
ProtobufFile after = new ProtobufFile(new File(UserPropsTest.class.getResource("after.proto").getFile()));
ProtobufCompatibilityCheckerLibrary checker = new ProtobufCompatibilityCheckerLibrary(after, before);
List<ProtobufDifference> entries = checker.findDifferences();
System.out.println(entries);
assertTrue(checker.validate());
}
}
Expected to pass and show no differences, actual output failure with console
[ProtobufDifference(message=2 fields removed without reservation, message Person), ProtobufDifference(message=Field name changed, message Person , before: addressId , after null)]
@EricWittmann see my reproducer and sample test with output
Thanks @mathianasj .