-
Notifications
You must be signed in to change notification settings - Fork 62
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
Parsing objects no longer works #54
Comments
Hey @benjaminsnorris -- can you try out #86 ? I added a quick test for it and it was failing on master with |
Thanks @KingOfBrian for checking on this. It seems to still be broken. Here is an example from a quick playground I made: //: Playground - noun: a place where people can play
import UIKit
import Marshal
let teamJSON: JSONObject = [
"name": "Engineering",
"managerId": "manager.id",
"teamMemberIds": [
"teamMember.id": true,
"secondTeamMember.id": true,
"thirdTeamMember.id": true,
],
]
struct Team: Unmarshaling {
var name: String?
var teamMemberIds = [String: Bool]()
var managerId: String?
init(object: MarshaledObject) throws {
if let teamMemberIdDictionaries: [String: Bool] = try object.value(for: "teamMemberIds") {
teamMemberIds = teamMemberIdDictionaries
} else {
teamMemberIds = [:]
}
managerId = try object <| "managerId"
name = try object <| "name"
}
}
let team = try? Team(object: teamJSON)
team?.teamMemberIds |
Thanks for the snipit, that actually pointed out a bug in the non-operator code. PR coming shortly. |
Just in case it's the same thing, with the latest changes, parsing |
Can you try out #91 @benjaminsnorris ? I think that will fix the operators, and you found a fun bug in the optional dictionary extraction which should force a new version unfortunately. Also, just a note from your snip-it, I really like the succinctness of the
|
@KingOfBrian sweet! If we get this working, I would love to be able to use the succinct version of the optional parsing. That will help clean things up considerably. |
@KingOfBrian unfortunately, it does not work. It parses just fine when the key is there, but when the key is not there, I get the |
Great catch @benjaminsnorris -- That was actually a bug, if you update that other branch it should work. I blame the cold. |
whoops not sure how this got closed by that PR |
We recently updated to v0.9.6, and found that some parsing is now broken. Previously, we could do
Now, I have to do something more like:
Another example is that I previously did this without problem:
The text was updated successfully, but these errors were encountered: