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
public struct ModelA: Codable {
public var intA: Int64
public var intANum: NSNumber? {
get {
return intA.map({ return NSNumber(value: $0) })
}
}
public var name: String?
public init(intA: Int64, name: String?) {
self.intA = intA
self.name = name
}
}
resulting in the error: - ERROR | xcodebuild: ModelA.swift: error: value of type 'Int64' has no member 'map'
This occurs for type Int64 and Bool.
The text was updated successfully, but these errors were encountered:
Yes, it seems that Int32 in the yaml definition is getting translated into Int/Int? whereas Int64 gets translated into Int64 in the generated Swift code.
Sal0g
pushed a commit
to Sal0g/openapi-generator
that referenced
this issue
Dec 5, 2018
- Models: Expose non-optional variables to @objc. Otherwise e.g. Int64 is not visible in objc
- Models: Try avoiding generated code that has boolVariable.map ({ return NSNumber(value: $0) }) as map does not exist for Bool in Swift (see Issue OpenAPITools#1456)
- API: Avoid Void? arguments with @objc, as they are not available in objc
Description
When using using Objc compatible code, the produced code is not valid in Swift 3/4.
Using openapi-generator Version 3.3.2
with the command:
and the config file api-generation-config.json:
and the yaml:
produces this code:
resulting in the error:
- ERROR | xcodebuild: ModelA.swift: error: value of type 'Int64' has no member 'map'
This occurs for type Int64 and Bool.
The text was updated successfully, but these errors were encountered: