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
When deserializing a class with a field whose type is an interface annotated with @JsonSubTypes, Micronaut looks for a default constructor on the interface:
io.micronaut.core.convert.exceptions.ConversionErrorException: Failed to convert argument [bodyDto] for value [null] due to: Error decoding property [Validator validator] of type [class com.example.demo.BodyDto]: Unable to deserialize type [Validator validator]: No default constructor exists
The main issue is your @Introspected(classes = Number.class). That breaks the introspection for the class it's on (Range) which breaks further serialization.
Removing that is not enough though. Serde does not have a deserializer for Number atm. So I will leave this issue open.
Expected Behavior
When deserializing a class with a field whose type is an interface annotated with
@JsonSubTypes
, Micronaut looks for a default constructor on the interface:You can find a non-working example with Micronaut 4 here: https://github.com/loicgreffier/issue-micronaut-serdes
And a working example with Micronaut 3 here: https://github.com/loicgreffier/micronaut-serdes-working
Actual Behaviour
The deserialization failed on the field annotated with @JsonSubTypes
Steps To Reproduce
A
with one or more implementations (A1
,A2
,A3
). Define the @JsonTypeInfo and @JsonSubTypes annotationsB
with a field typed with the interfaceA
B
as a body of an HTTP request to a REST endpointEnvironment Information
No response
Example Application
https://github.com/loicgreffier/issue-micronaut-serdes
Version
4.1.0
The text was updated successfully, but these errors were encountered: