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

Handle unparsable dictionaries better #31

Open
mac-cain13 opened this issue Feb 22, 2016 · 0 comments
Open

Handle unparsable dictionaries better #31

mac-cain13 opened this issue Feb 22, 2016 · 0 comments

Comments

@mac-cain13
Copy link
Contributor

Only [String: *] dicts are supported by JsonGen, since a Json dictionary key always is a string. I tried to outsmart JsonGen by creating this:

enum MyKey: String {
  case SomeKey = "SomeKey"
}

struct MyJsonStruct {
  let someDict: [MyKey: OtherJsonStruct]
}

JsonGen gave me the impression that it could work because the Dictionary.decodeJson method takes a key decoder that is somewhat generic. But it really only will work with String keys because of the direct case to [Key: Value] that JsonGen performs, maybe this is something that could be a little stricter.

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

No branches or pull requests

2 participants