ObjectMapper is reinitialized during graphhopper bundle creation


I’ve noticed that GraphhopperBundle.initialize(...) does bootstrap.setObjectMapper(io.dropwizard.jackson.Jackson.newMinimalObjectMapper());. This leads my Dropwizard application to fail during the config.yaml parsing with error:

io.dropwizard.configuration.ConfigurationParsingException: config/config.yaml has an error:
  * Unrecognized field at: server.applicationConnectors
    Did you mean?:
      - application_connectors
      - application_context_path
      - admin_connectors
      - admin_min_threads
      - allowed_methods

This is because my config.yaml follows camelCase naming strategy but minimalObjectMapper set up by GHBundle uses snake_case naming strategy.

If I store existing ObjectMapper before initializing GHBundle and set it back via bootstrap.setObjectMapper() then graphhopper fails during startup.

I’m wondering what would be the best solution for this problem. Is it a bug/limitation/requirements? Maybe Graphhoper bundle can use its own initialized ObjectMapper disregard of already registered one. I’m quite new to Dropwizard and this behaviour looks strange to me.

We will force snake case from 1.0, so it is a requirement, yes. You can convert your existing config.yml from camelCase to snake_case by hand or use this tool: https://github.com/karussell/snake_case

This tool also changes the recent changes regarding the profile section.

Thank you for reply. That’s unfortunate because “my” object mapper is provided by my infrastructure libraries and I’m not sure that it won’t break anything else. Anyway, thank you for the answer. I will develop accordingly.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Powered by Discourse