Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DecodingError: ManeuverDirection "reverse" not found #594

Open
sj1914 opened this issue Sep 21, 2021 · 4 comments
Open

DecodingError: ManeuverDirection "reverse" not found #594

sj1914 opened this issue Sep 21, 2021 · 4 comments
Labels

Comments

@sj1914
Copy link

sj1914 commented Sep 21, 2021

Hi there

We are frequently getting an error from mapbox when trying to calculate a route using the MapboxDirections API:

 ▿ underlying : Optional<Error>
      ▿ some : DecodingError
        ▿ dataCorrupted : Context
          ▿ codingPath : 10 elements
            - 0 : CodingKeys(stringValue: "routes", intValue: nil)
            ▿ 1 : _JSONKey(stringValue: "Index 0", intValue: 0)
              - stringValue : "Index 0"
              ▿ intValue : Optional<Int>
                - some : 0
            - 2 : CodingKeys(stringValue: "legs", intValue: nil)
            ▿ 3 : _JSONKey(stringValue: "Index 9", intValue: 9)
              - stringValue : "Index 9"
              ▿ intValue : Optional<Int>
                - some : 9
            - 4 : CodingKeys(stringValue: "steps", intValue: nil)
            ▿ 5 : _JSONKey(stringValue: "Index 0", intValue: 0)
              - stringValue : "Index 0"
              ▿ intValue : Optional<Int>
                - some : 0
            - 6 : CodingKeys(stringValue: "bannerInstructions", intValue: nil)
            ▿ 7 : _JSONKey(stringValue: "Index 0", intValue: 0)
              - stringValue : "Index 0"
              ▿ intValue : Optional<Int>
                - some : 0
            - 8 : CodingKeys(stringValue: "primary", intValue: nil)
            - 9 : CodingKeys(stringValue: "modifier", intValue: nil)
          - debugDescription : "Cannot initialize ManeuverDirection from invalid String value reverse"
          - underlyingError : nil
    - code : nil
    - message : nil

When diving in to this further, it looks like this enum value indeed does not exist in the code:

https://github.com/mapbox/mapbox-directions-swift/blob/main/Sources/MapboxDirections/RouteStep.swift

Here is a snippet of an example of one of the offending JSON responses:

                            "bannerInstructions": [
                                {
                                    "primary": {
                                        "components": [
                                            {
                                                "type": "text",
                                                "text": "Enter Winwick Interchange and take the 3rd exit"
                                            }
                                        ],
                                        "degrees": 307,
                                        "driving_side": "left",
                                        "type": "roundabout",
                                        "modifier": "reverse",  <---- ???? 
                                        "text": "Enter Winwick Interchange and take the 3rd exit"
                                    },
                                    "distanceAlongGeometry": 0
                                }
                            ],

Unless i am mistaken it appears the library is not equipped to decode this object.

Keen to hear of a solution, hope this is helpful!

Thanks.

@S2Ler
Copy link
Contributor

S2Ler commented Sep 23, 2021

Thank you @sj1914 for the taking time to create a detailed issue 👍. We are looking into this issue, meanwhile, can you please share the request to Directions that causes this issue?

@S2Ler
Copy link
Contributor

S2Ler commented Sep 23, 2021

A minimal example that reproduce the issue would help even more.

@1ec5
Copy link
Contributor

1ec5 commented Sep 27, 2021

(If modifier is coming out of the Directions API as reverse, then that would be a bug in the Directions API, since this field is documented as returning uturn in that case. reverse is only a valid value for the turn:lanes key in OpenStreetMap, not a maneuver or lane indication in the DIrections API.)

@truburt truburt added bug needs more information Can't proceed without more data. and removed awaiting user response labels Sep 29, 2021
@kried
Copy link
Contributor

kried commented Oct 14, 2022

We don't have enough data to reproduce the issue for now. Directions API returns "modifier": "uturn" in test requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants