swift-bson
swift-bson copied to clipboard
SWIFT-325 BSON init int64 inconsistency. (Not a bug)
When initing a BSON from a literal it is an int64 by default, but is easy to change (.int32(5)). However when using JSON the "default" type is int32.
Is there a method to force JSON to give int64 as the default type for small value ints?
We have
/// Initialize a BSON
from an integer. On 64-bit systems, this will result in an .int64
. On 32-bit systems,
/// this will result in an .int32
.
public init(integerLiteral value: Int) {
self.init(value)
}
But for JSON we have // Spec requires that we try int32, try int64, then try double for decoding numbers if let int32 = try Int32(fromExtJSON: json, keyPath: keyPath) { self = int32.bson return }