You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In version 3.0.3 of yasson, the elements of a list do not have their Serializers called. This issue does not happen in version 2.0.4.
In the following example, if a List<Temp> is serialized, the serializer will not throw the exception (or be called). If Temp is serialized by itself, the serializer will be called.:
@JsonbTypeSerializer(Temp.Serializer.class)
public class Temp {
private List<UUID> vals;
public List<UUID> getVals() {
return vals;
}
public Temp(List<UUID> vals) {
this.vals = vals;
}
public static class Serializer implements JsonbSerializer<Temp> {
@Override
public void serialize(Temp obj, JsonGenerator generator, SerializationContext ctx) {
throw new UnsupportedOperationException("Unimplemented method 'serialize'");
}
}
}
To Reproduce
Included sample app with unit tests to replicate the problem. yasson-bug-sample.zip
Expected behavior
Expected that a list would be serialized.
System information:
OS: Windows
Java Version: 17
Yasson Version: 3.0.3
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Was able to get a workaround working by using jsonbConfig. If you update the ExampleTests.java to pass in a jsonbConfig then it will work. Something like this:
@BeforeEach
void setup() {
myClass = new MyClass("test");
JsonbConfig jsonbConfig = new JsonbConfig();
var serializer = new JsonbSerializer[]{
new MyClass.Serializer()
};
jsonbConfig.withSerializers(serializer);
jsonb = JsonbBuilder.create(jsonbConfig);
}
Describe the bug
In version
3.0.3
of yasson, the elements of a list do not have their Serializers called. This issue does not happen in version2.0.4
.In the following example, if a
List<Temp>
is serialized, the serializer will not throw the exception (or be called). IfTemp
is serialized by itself, the serializer will be called.:To Reproduce
Included sample app with unit tests to replicate the problem.
yasson-bug-sample.zip
Expected behavior
Expected that a list would be serialized.
System information:
Additional context
N/A
The text was updated successfully, but these errors were encountered: