Skip to content

avoid manual parsing in GraphHopperWeb #1137

Closed

Description

@karussell

Make it possible to just write:

GHResponse res = objectMapper.readValue(str, GHResponse.class);

and this will also simplify or remove the code in SimpleRouteSerializer.

(We need further custom serialize code for the polyline encoding stuff)

Activity

  1. michaz commented on Aug 22, 2017

    @michaz
    Member

    What is the general plan for the client? Elsewhere I was suggesting to remove it, but only because it's duplicated in another project.

    In general, it can of course be a good idea to have the (same-language) client in the same repository, precisely because serialization code and representations can be shared. Dropwizard recommends it. It should go into a different JAR, of course, so rather than being in "web", it should be in a "client" module. Client code can then include the client JAR and that's it..

    So maybe we move the "hand-coded" client over here? In general?

  2. karussell commented on Aug 22, 2017

    @karussell
    MemberAuthor

    Yes, this might be a good solution to move the hand-coded into a new client maven module. The only problem is that we would either have to split the hand-coded matrix part and keep it externally or put it here, which would mix the open source with the API which I would like to avoid to reduce confusion.

  3. karussell commented on Aug 22, 2017

    @karussell
    MemberAuthor

    which would mix the open source with the API which I would like to avoid to reduce confusion.

    Hmmh, this is kind of 'violated' already as the GraphHopperWeb points to the commercial offering per default. So moving the hc client into this repo sounds good to me and we can finally avoid duplicate code.

  4. michaz commented on Aug 22, 2017

    @michaz
    Member

    Related: What is the plan for the Swagger spec? Is it just a side-project, or do we want to make it more authoritative by reviewing it, adding documentation and perhaps eventually generating the official API docs from it?

  5. karussell commented on Aug 22, 2017

    @karussell
    MemberAuthor

    Is it just a side-project

    Definitely not. Why do you think so?

    Related: What is the plan for the Swagger spec?

    The swagger spec and clients generated are already working. Also there is a bit documentation for this already inside the spec. But a few bigger issues remain (limitation of either the codegen or swagger spec itself) like https://github.com/graphhopper/directions-api-clients/issues/1

  6. michaz commented on Aug 22, 2017

    @michaz
    Member

    Definitely not. Why do you think so?

    Just asking. For example, it does not generate the official API documentation, but duplicates it.

  7. michaz commented on Aug 22, 2017

    @michaz
    Member

    So moving the hc client into this repo sounds good to me and we can finally avoid duplicate code.

    I could do that on the Dropwizard-PR. Would fit nicely there because of close connections to "doing more with Jackson" and "sharing representations".

  8. karussell commented on Aug 22, 2017

    @karussell
    MemberAuthor

    I could do that on the Dropwizard-PR. Would fit nicely there because of close connections to "doing more with Jackson" and "sharing representations".

    I'm more for smaller PRs :) maybe a second PR based on the Dropwizard branch?

  9. michaz commented on Aug 22, 2017

    @michaz
    Member

    Okay, sure.

  10. boldtrn commented on Aug 24, 2017

    @boldtrn
    Member

    I thought the approach would be the other way around? Move the GraphHopperWeb file into the hc part and use this as a test dependency? The GraphHopperWeb is only used for testing purposes.

  11. karussell commented on Aug 24, 2017

    @karussell
    MemberAuthor

    The problem then will be that we have a circular dependency of the repositories: test web module (GH repo) -> hc client (other repo) -> core (GH repo) which might be too complex (?)

  12. michaz commented on Aug 24, 2017

    @michaz
    Member

    Dependencies aside, the argument for having client and server in the same repository is that they can (easily) share the same representation objects and serialization/deserialization code, and that the developer of the server will also develop the client, looking at the whole use case.

    What are the arguments for having it in a separate repository?

    "A user may only want the client" -- okay, but they will usually use a Maven dependency, not check out the source code.

  13. michaz commented on Aug 24, 2017

    @michaz
    Member

    Note: I also really like the Swagger stuff and auto-generated clients, but I think those are a different story, and would perhaps be better off if they were in their repository alone, without the "hand-coded" stuff. That whole repository could basically be auto-generated by Swagger.

  14. boldtrn commented on Aug 25, 2017

    @boldtrn
    Member

    What are the arguments for having it in a separate repository?

    Well it depends, if we put the client into it's own package, I don't see a good reason against this, besides some users might be a bit confused that suddenly the location of the client changed. If we leave the client (GraphHopperWeb) in the web client the downside is that anybody using the client would end up with all the dependencies of the web module.

    I also really like the Swagger stuff and auto-generated clients, but I think those are a different story, and would perhaps be better off if they were in their repository alone, without the "hand-coded" stuff. That whole repository could basically be auto-generated by Swagger.

    Yes, I am fine with that. We should also note that right now the hc client cannot solve all functions of the API (e.g. geocoding).

  15. devemux86 commented on Aug 25, 2017

    @devemux86
    Contributor

    the downside is that anybody using the client would end up with all the dependencies of the web module.

    Agreed that wouldn't be nice.

  16. michaz commented on Aug 25, 2017

    @michaz
    Member

    Agreed that wouldn't be nice.

    Yeah, it would go in its own module, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions