crossbario / autobahn-java

WebSocket & WAMP in Java for Android and Java 8
https://crossbar.io/autobahn
MIT License
1.52k stars 427 forks source link

custom ObjectMapper feature #552

Closed pavelvic closed 8 months ago

pavelvic commented 8 months ago

Hello again my friends! There is no ability to use custom ObjectMapper in your Java-lib. The configuration of ObjectMapper is hardcoded in class "ISerializer"

public ISerializer(JsonFactory factor) {
        mapper = new ObjectMapper(factor);
        mapper.findAndRegisterModules();
        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
        mapper.configure(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE, false);
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    }

This is not good. I think there is a better way. For example, we can inject ObjectMapper from the client. So the client can configure mapper based on his needs. What do you think?

oberstet commented 8 months ago

Hi Pawel, I had a look, and it makes a lot of sense, and it is also non-invasive for users. and the CI runs green for your PR. thanks for contributing! merging ..