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

JSON expression parse with object #1989

Closed
mfazekas opened this issue Jul 11, 2023 · 4 comments
Closed

JSON expression parse with object #1989

mfazekas opened this issue Jul 11, 2023 · 4 comments
Labels
bug 🪲 Something is broken!

Comments

@mfazekas
Copy link
Contributor

Environment

  • Xcode version: 14.3.1 (14E300c)
  • iOS version: 17.0
  • Devices affected: Simulator iPhone 14 Pro
  • Maps SDK Version: #main (cf286de)

Observed behavior and steps to reproduce

let expressionString =
        """
        [
            "get",
            "akey",
            ["literal",
                {
                    "akey":"aval",
                    "bkey":"bval",
                }
            ]
        ]
        """
        
        let expressionData = expressionString.data(using: .utf8)!
        let expression = try! JSONDecoder().decode(Expression.self, from: expressionData)
        print("?? decode expression \(expression) from \(expressionString)")

Expected behavior

I'd expect that the object is parsed as the argument to literal.
But instead I get an empty format expression:

?? decode expression [get, akey, [literal, format(MapboxMaps.FormatOptions(fontScaleValue: nil, textFontValue: nil, textColorValue: nil))]] from [
    "get",
    "akey",
    ["literal",
        {
            "akey":"aval",
            "bkey":"bval",
        }
    ]
]

Also if I serialise the expression I get:

       let coded = try! JSONEncoder().encode(expression)
        print("=> coded as: \(coded) \(String(data: coded, encoding: .utf8))")
Optional("[\"get\",\"akey\",[\"literal\",{}]]")

Notes / preliminary analysis

Additional links and references

@mfazekas mfazekas added the bug 🪲 Something is broken! label Jul 11, 2023
mapbox-github-ci-writer-public-1 bot pushed a commit that referenced this issue Jan 22, 2024
* Refactor xcodegen

* Collect coverage for all targets

* Improve double-tap gesture test

* Add _settings suffix to setting groups
@csimpi
Copy link

csimpi commented Dec 11, 2024

@Mapbox-Adam4472 @mapbox-chrisshumaker What's up with this?

@OdNairy
Copy link
Contributor

OdNairy commented Dec 11, 2024

Hi @mfazekas , @csimpi
I could reproduce the issue and confirm that our Expression decoding strategy has a bug.
Let me make a ticket in our internal system (MAPSIOS-1678).

@OdNairy
Copy link
Contributor

OdNairy commented Dec 23, 2024

Hey @mfazekas @csimpi
Good news - @evil159 has fixed the reported issue (checkout commit fe94972).
Please check the main branch for a fix to get us proper feedback.
You could expect those changes to be a part of the 11.10.0 release (ETA mid February 25).

@OdNairy OdNairy closed this as completed Dec 23, 2024
OdNairy referenced this issue Dec 23, 2024
Co-authored-by: Mai Mai <mai.mai@mapbox.com>
@csimpi
Copy link

csimpi commented Dec 23, 2024

@OdNairy Thank you guys, we really-really appreciate it. Fingers crossed for the February release.
Merry Christmas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken!
Projects
None yet
Development

No branches or pull requests

3 participants