If java class has @JsonCreator and there is no @JsonValue then Hilla throws en exception, that both annotations must be presented. But @JsonCreator can be used alone. Jackson parses these classes successfully. Is there any solution how to let Hilla generate this class as DTO and not as single-value?
No, there’s currently no way to parse such a class. The reason is that the serialized and deserialized types must be the same in Hilla.
Anyway, if you can provide a use case, we could consider a different behavior for those cases.
Use case is simple. I use 3rd party library, where more than one constructors whithin one Java class. So, author marked one of constructor with @JsonCreator to let Jackson parse it successfully, because for multiple constructors Jackson can fail to choose correct constructor. I need this class as DTO with all the internal fields. Adding @JsonValue breaks the buisness logic as it is not single-value class.
More over, in Hilla 24.5.8 I copied main DTO to my project and removed @JsonCreator as workaround. But this DTO has nested keys which also have @JsonCreator alone. So, 24.5.8 works fine (ignores that nested keys don’t have @JsonValue) and generated TS classes as I expect. But, when I changed Hilla version to 24.6.0 it failed with exception about nested keys.
So, I am not able to use 24.6.0 and laler releases in my project