Open Cy-4AH opened 4 years ago
Happy to accept an easy PR for this
I just hit what I think is a related issue, where an OpenAPI spec that includes a bare object
field generates a model with [String: Any]?
that isn't Equatable
.
In our codebase we have an enum that looks like this:
enum JSONAny: Codable, Equatable {
case bool(_ value: Bool)
case int(_ value: Int)
case float(_ value: Double)
case string(_ value: String)
case array(_ value: [JSONAny])
case dict(_ value: [String: JSONAny])
case null
...
Generating with --option anyType:JSONAny
would fix it (and maybe ModelWithAdditionalProperties
too) if I could get JSONAny
in scope. Some possible ways of doing that:
--option addFile:JSONAny.swift
?--option addImport:JSONAny
?@yonaskolb let me know if you like any of those options, and I can put together a PR.
@Cy-4AH --option anyType:Data
may be another workaround
Petstore spec generates
if generated with options modelType:struct modelInheritance:false