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
public class Views {
public static class Public {}
public static class Secret extends Public {}
}
Actual Behaviour
java.lang.ClassCastException: class com.example.User cannot be cast to class java.util.Optional (com.example.User is in unnamed module of loader 'app'; java.util.Optional is in module java.base of loader 'bootstrap')
at io.micronaut.serde.support.serdes.OptionalSerde$1.serialize(OptionalSerde.java:53)
at io.micronaut.serde.jackson.JacksonJsonMapper.writeValue(JacksonJsonMapper.java:187)
at io.micronaut.serde.jackson.JacksonJsonMapper.writeValueAsBytes(JacksonJsonMapper.java:285)
at io.micronaut.json.codec.MapperMediaTypeCodec.encode(MapperMediaTypeCodec.java:265)
at io.micronaut.http.server.netty.jackson.JsonViewServerFilter.lambda$doFilter$1(JsonViewServerFilter.java:102)
at reactor.core.publisher.MonoCallable.call(MonoCallable.java:72)
at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:228)
If I comment out the JsonView annotation, the exception is not thrown.
Steps To Reproduce
Annotate an optional controller method with JsonView
Expected Behavior
A controller method with the following signature should return data:
Actual Behaviour
If I comment out the JsonView annotation, the exception is not thrown.
Steps To Reproduce
Environment Information
Example Application
https://github.com/goeh/micronaut-jsonview-issue
Version
4.5.0
The text was updated successfully, but these errors were encountered: