first of all, thanks for building this generator. It is a pleasure to use.
While debugging, I stumbled upon a problem with the way freeform dictionary fields (such as[String: Any]) are being encoded. Where 0 and 1 can be valid integer fields, they are being encoded as booleans. Looking at the implementation of AnyCodable.swift, it seems like in these cases Bool is the first (and best match), although not entirely correct. I know it is possible to cast and type check booleans using CFBooleanRef within NSJSONSerialization and then encode/decode correctly. I'm not sure the same trick also applies to Codable-based serializations though.
Hi there 👋,
first of all, thanks for building this generator. It is a pleasure to use.
While debugging, I stumbled upon a problem with the way freeform dictionary fields (such as
[String: Any]
) are being encoded. Where0
and1
can be valid integer fields, they are being encoded as booleans. Looking at the implementation of AnyCodable.swift, it seems like in these cases Bool is the first (and best match), although not entirely correct. I know it is possible to cast and type check booleans usingCFBooleanRef
withinNSJSONSerialization
and then encode/decode correctly. I'm not sure the same trick also applies to Codable-based serializations though.