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
Swift enum types are incorrect using swagger-codegen when the type should be a custom class
codegen generates an enum of Strings instead of an enum of custom types
Code generated by codegen:
public enum SomeType: String {
case foo = "Foo"
case bar = "Bar"
case bee = "Bar"
}
I have manually managed to fix the enum and this is the correct Swift enum with custom types, where Foo, Bar and Bee are all custom classes that inherit from the same class in which SomeType is declared.
public enum SomeType {
case foo(Foo)
case bar(Bar)
case bee(Bee)
}
The Java version of swagger-codegen has been fixed already and generates the following, correct code:
Not sure I understand. In that spec snippet there are only enums with type string. Could you post part of a spec and then what you would expect to be generated?
Description
Swift enum types are incorrect using swagger-codegen when the type should be a custom class
codegen generates an enum of Strings instead of an enum of custom types
Code generated by codegen:
I have manually managed to fix the enum and this is the correct Swift enum with custom types, where Foo, Bar and Bee are all custom classes that inherit from the same class in which SomeType is declared.
The Java version of swagger-codegen has been fixed already and generates the following, correct code:
Swagger-codegen version
2.2.2
Swagger declaration file content or url
Command line used for generation
swagger-codegen generate -i /path/spec.yaml -l swift3
Steps to reproduce
Generate swift3 code using codegen from command line with the above specification file
Related issues
#4484
Suggest a Fix
The text was updated successfully, but these errors were encountered: