-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Preface: I've looked at a whole bunch of different JSON libraries for a talk I gave last week on JSON parsing in Swift. The talk was partly about different libraries, and partly about the JsonGen code generator I've build. Although I didn't mention JSONCodable in the talk, it is in my opinion one of the best JSON libraries I've looked at.
One of the very few features I miss in JSONCodable is verbose error messages. In JsonGen I try to include as much information as possible about errors in the JSON. So it's easier to debug problems in JSON coming from the server.
These two features in particular:
- Include the complete "path" of the error.
- Collect all errors, instead of stoping at the first error.
From my post on error messages, these are the types of error messages JsonGen generates:
2 errors in Blog struct
- subTitle: Value is not of expected type String?: `42`
▿ posts: 2 errors in array
▿ [1] 1 error in Post struct
- title: Field missing
▿ [2] 3 errors in Post struct
- title: Value is not of expected type String: `1`
- body: Value is not of expected type String: `42`
▿ author: 2 errors in Author struct
- name: Field missing
- email: Field missing
Feel free to close this issue if this isn't something you're interested in for JSONCodable. It's just something I wanted to bring to your attention.