Repository navigation
no need to explicitely list the snake case methods - #1918
Conversation
There was a problem hiding this comment.
With such a strategy we could enable it globally and annotate only GraphHopperConfigMixIn (or should we create something like this?)
Hm not sure, I do not think we will get along without any mixins (for example because of @JsonAnySetter). Or maybe I did not understand what we could possibly enable globally?
| return initObjectMapper(new ObjectMapper()); | ||
| } | ||
|
|
||
| public static ObjectMapper initObjectMapperWithSnake(ObjectMapper objectMapper) { |
There was a problem hiding this comment.
Do we ever want the mapper without the snake strategy? If not maybe we could simply put this in the existing initObjectMapper?
There was a problem hiding this comment.
If we define the snake case globally, which I would really prefer, then we would need to rewrite all our config.yml (should we avoid this?). See 2f2567b
There was a problem hiding this comment.
Wait what do you prefer? You want to use snake case everywhere? But isn't this what we do (the current config.yml uses snake case). And in 2f2567b you converted everything to camel case?
There was a problem hiding this comment.
I would prefer a global snake case, yes. But this would break existing config.yml files as it includes e.g. applicationConnectors and it would be necessary to change this (and several other things) to snake_case.
I'm not sure if we should do this.
But isn't this what we do (the current config.yml uses snake case)
No, unfortunately not. See all the camelCase config properties from dropwizard. Also when switching to global snake case still the requestLog property made problems and wasn't available as snake_case, maybe something related to dropwizard/dropwizard#1558
There was a problem hiding this comment.
Ah right dropwizard uses camel case. But if thats the default why do we not just use camel case everywhere? Ok I would agree that snake case is prettier / more readable and more consistent with url parameters...
There was a problem hiding this comment.
we are breaking the configuration in many ways I think
Ah, indeed. Then I'll rework this PR to use the snake_case globally and document it in the changelog.
Also regarding the "dot": could we convert the current state:
datareader.file: somefile.pbf into an object structure like
datareader:
file: somefile.pbfThere was a problem hiding this comment.
could we convert the current state: datareader.file: somefile.pbf into an object structure like
I think thats the point. When the property name is datareader.file (in the command line argument at least) dropwizard interprets this as the file property of the datareader object. The datareader object is missing in the configuration and thus the override fails. Otherwise yes we could convert it into an object structure, but this must be reflected on the java side (GraphHopperConfig.java). If we start grouping parameters together we should try to find out which ones are really related such that the sub-objects of GraphHopperConfig represent a meaningful decomposition and we can pass around these sub-objects to the different components (which ideally do not need to know anything about the other sub-objects). For example I did this with RoutingConfig in the GraphHopper class even though this is so far only done internally (not in config.yml yet).
There was a problem hiding this comment.
But maybe this is something for GH 2.0 as its also related to how we will deal with the graphhopper folder cache/database in the future and what kind of refactorings will be done to the GraphHopper class, what should belong to the 'core' etc. :)
There was a problem hiding this comment.
Ok. So we keep the dots in the pararameters for 1.0 but move everything to snake_case?
|
To make the transition a bit easier I have created https://github.com/karussell/snake_case which converts all the camelCase keys into snake_case (the only problem is that it removes the comments) |
of GHRequest in GHRequestMixIn.
Unfortunately there seems to be no lowerCamelCase naming strategy. With such a strategy we could enable it globally and annotate only GraphHopperConfigMixIn (or should we create something like this?)