Closed renpillay closed 7 years ago
It sounds more like a flaw -- perhaps some checks/handling does not consider wrappers, only primitive types. If so, I think they should.
Thank you for reporting this.
@renpillay Could you elaborate bit on what you mean by failing to generate schema here? Simple addition of a Boolean
valued property does not seem to trigger an exception for me, with 2.9.0.
So I assume you are doing something else (or possibly using an old version)?
Hi @cowtowncoder
I'm using jackson 2.9.3 (com.fasterxml.jackson.dataformat/jackson-dataformat-protobuf).
The exact code I'm using is the following
public static class Employee
{
public String name;
public int age;
public String[] emails;
public Employee boss;
public Boolean someBool;
}
private final ProtobufMapper objectMapper = new ProtobufMapper();
// Then later on
ProtobufSchemaGenerator gen = new ProtobufSchemaGenerator();
ProtobufSchema schema = objectMapper.generateSchemaFor(Employee.class);
At this point, the exception I get is UnsupportedOperationException with the content "'Boolean' type not supported as root type by protobuf"
However, I'm using 2.8.4, so its possible this has been fixed later on. Let me try updating my version.
Looks like I get the same behaviour on 2.9.0
@renpillay That test works for me, with master
(2.9.0). Same for 2.8.
So I can not reproduce the problem: I suspect fix was in 2.8.8 or 2.8.9.
Please make sure new version is used and that no old version is accidentally included in classpath.
Using the following code to generate a Protobuf schema fails to generate a schema when there's an element in Employee.class of type Boolean. But it generates fine with the type boolean.
eg.
Is this expected, and if so - is there a workaround that does not involve changing the class definition?