You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the addition of an actual JSON.Bool case, it seems that the implicit .Number conversion to Bool has been broken. Was this intentional? It's unfortunately common for backend software to return boolean values as 1 or 0. Previously Argo was able to automatically convert these to Bool. Now that's no longer possible. I believe the previous behavior could be returned by adding the previous behavior back to the BoolDecodable extension:
extensionBool:Decodable{
/**
Decode `JSON` into `Decoded<Bool>`.
Succeeds if the value is a boolean, otherwise it returns a type mismatch.
- parameter j: The `JSON` value to decode
- returns: A decoded `Bool` value
*/
publicstaticfunc decode(j:JSON)->Decoded<Bool>{switch j {caselet.Bool(n):returnpure(n)caselet.Number(n as Bool):returnpure(n)default:return.typeMismatch("Bool", actual: j)}}}
Would that be an acceptable change?
The text was updated successfully, but these errors were encountered:
With the addition of an actual
JSON.Bool
case, it seems that the implicit.Number
conversion toBool
has been broken. Was this intentional? It's unfortunately common for backend software to return boolean values as1
or0
. Previously Argo was able to automatically convert these toBool
. Now that's no longer possible. I believe the previous behavior could be returned by adding the previous behavior back to theBool
Decodable
extension:Would that be an acceptable change?
The text was updated successfully, but these errors were encountered: