-
Notifications
You must be signed in to change notification settings - Fork 6k
[Swift] Incorrect generation emun type for swift language #3934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@razalur thanks for reporting the issue. I'll take a look later today. |
@razalur PR merged into master. Please pull the latest master to give it a try. |
It seems that nothing changed... Please, check it again.... public enum Level: String {
case 1 = "1"
case 2 = "2"
case 3 = "3"
case 4 = "4"
} instead of public enum Level: String {
case Number1 = "1"
case Number2 = "2"
case Number3 = "3"
case Number4 = "4"
} |
@razalur did you use editor.swagger.io to generate the Swift API client? editor.swagger.io is using the latest stable version (not the latest master) so plesae build the JAR locally based on the latest master. |
I use: java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i /Users/User/Desktop/test.json -l swift -o /tmp/ Is it right way? |
Did you do a |
No. Thank you! Now it's ok! |
Hello. Actually, the PR does not solve completely the problem. For example, for this type of definition : resolution:
type: string
enum:
- 640x360
- 950x540
- 1280x720
- 1920x1080
- 2592x1458 Executing with the latest version :
Outputs : public enum Resolution: String {
case 640x360 = "640x360"
case 950x540 = "950x540"
case 1280x720 = "1280x720"
case 1920x1080 = "1920x1080"
case 2592x1458 = "2592x1458"
} which is not valid Swift3 code. |
Description
Hello! I generate client for swift language. There is incorrect swift language syntax generated for enum type.
For example for this json code:
I've got this swift code for enum type "Level":
As you can see there are numbers after "case" keywords. But this is not correct syntax for swift (compiler error: "Expected identifier in enum 'case' declaration"). Unfortunately I can't change my json to avoid this. May be it is possible to change somehow the logic for swift code generation to get right solution?
Best regards,
Aleksey Razzhivaykin
The text was updated successfully, but these errors were encountered: