-
Notifications
You must be signed in to change notification settings - Fork 67
SWIFT-178 Conform various options/result types to Decodable #269
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
SWIFT-178 Conform various options/result types to Decodable #269
Conversation
| let decoder = BSONDecoder() | ||
| var insertedIds = result?.insertedIds | ||
|
|
||
| var bulkWriteErrors: [BulkWriteError]? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using fail points, sometimes empty (but non-nil) writeErrors and writeConcernErrors arrays are returned for parsing. The way this function was written assumed that wasn't possible and has been rewritten to accommodate those cases.
kmahar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, just one thing to check re: docs
| /// Map of the index of the operation to the id of the upserted document. | ||
| public let upsertedIds: [Int: BSONValue] | ||
|
|
||
| private enum CodingKeys: CodingKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it always annoys me that the synthesized code is all or none and you can't use the synthesized coding keys if you use a custom init(from:) implementation...
mbroadst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just two questions
This is part of a series of reviews that make up SWIFT-178
This PR adds
Decodableconformance to options and result types that will eventually be decoded from JSON spec test files. It also improves the error parser to be more flexible when decoding from server replies.