Description
Description
Hello, i try to generate my Server API in Swift 3 with swagger-codegen.
But my enums are created wrong.
The output of a class with an enum property looks like this
`
open class DTO: JSONEncodable {
public enum Status: String {
case RAWSTARTED_ENUMSTARTED = "'{raw=STARTED, enum=Started}'"
case RAWPAUSED_ENUMPAUSED = "'{raw=PAUSED, enum=Paused}'"
case RAWFINISHED_ENUMFINISHED = "'{raw=FINISHED, enum=Finished}'"
}
public var startedAt: Int64?
public var status: Status?
public init() {}
open func encodeToJSON() -> Any {
var nillableDictionary = [String:Any?]()
nillableDictionary["startedAt"] = self.startedAt?.encodeToJSON()
nillableDictionary["status"] = self.status?.rawValue
let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:]
return dictionary
}
}`
I use the Status type in more than one class and its generated within each DTO file additionally.
Swagger-codegen version 2.2.1
i use the version 2.2.1 which i exported from this project
Swagger declaration file content or url
this is the line i use to generate my code
#2. swagger code generieren
echo —————GENERATE CODE FILES----------------
java -jar swagger-codegen-cli-2.2.1.jar generate -i ./swagger-definition.json -l swift -o newAPI -t swift3_template
the swift3_template folder is from this projects directory too /modules/swagger-codegen/src/main/resources/swift3
within the samples/client/petstore/swift3 folder there are models with enum types which are generated correctly.
i tried using -l swift3 but this is not available although in the /bin/swift3-petstore.sh there is the following content
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift3 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c ./bin/swift3-petstore.json -o samples/client/petstore/swift3/default"
here is a language of -l swift3 defined?
what am i doing wrong?