This is not a solution, but beware that starting from Jackson 2.10, 
`ObjectMapper.enableDefaultTyping` has been deprecated and 
`ObjectMapper.enableDefaultTyping` internally calls 
`activateDefaultTyping()`.
On Wednesday, June 28, 2023 at 4:22:40 AM UTC+9 Martin Samm wrote:

> So, i have an issue i'm struggling to resolve. I have a service making a 
> REST call to another service. Using jackson 2.12.7 all's well. Upgrading to 
> jackson 2.13.5 the same code, config etc i'm getting this error:
>
> Could not resolve subtype of [simple type, class 
> com.rapid7.platform.ipims.domain.PlatformUser]: missing type id property 
> '@class' 
>
> The PlatformUser class is a straight forward POJO (and again unchanged) 
> with the following props:
>
> private String userId;
> private Customer customer;
> private String email;
> private String oktaUserId;
> private Long createdTime;
> private Long lastLoginTime;
> private boolean multiCustomer = false;
> private boolean externalIdp;
> private Map<String, String> userProperties = new HashMap<>();
>
>
> We're using a Mixin to avoid deserializing userProperties Map.
>
> Our objectMapper is setup like this:
> private ObjectMapper objectMapper() {
> ObjectMapper mapper = new ObjectMapper();
> mapper.enableDefaultTyping(
> ObjectMapper.DefaultTyping.NON_FINAL,
> JsonTypeInfo.As.PROPERTY
> );
> mapper.registerModule(new CoreJackson2Module());
> mapper.registerModule(new WebJackson2Module());
> mapper.registerModule(new WebServletJackson2Module());
> mapper.registerModule(new WebServerJackson2Module());
> mapper.registerModule(new Saml2Jackson2Module());
> mapper.registerModules(new Saml2Jackson2Module());
> mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false
> );
> // handle Java 8 Datetime with JSR-310
> mapper.registerModule(new JavaTimeModule());
> mapper.addMixIn(PlatformUser.class, PlatformUserMixin.class);
> mapper.addMixIn(MapSession.class, MapSessionMixin.class);
> return mapper;
> }
>
>
> Debugging through the code i can see the objectmapper is wired in fine and 
> that the objectMapper is setting it's valueType to a SimpleType[simple 
> type, class PlatformUser] so things seem setup correctly but at some point 
> something odd is happening and an AsPropertyTypeDeserializer is used and 
> triggers the above exception (seems to be expecting the JSON to contain an 
> @class definition/declaration, which was unnecessary previously).
>
> So, can anyone help point me in the right direction?
>
> Thanks alot.
>
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/e5661962-2d45-435e-be28-1f568808ef67n%40googlegroups.com.

Reply via email to