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
We recently started migration to new apollo-ios-cli code generation tool and something that was working before, with old code generator, is no longer working.
Versions
Please fill in the versions you're currently using:
apollo-ios SDK version: 1.0.3
Xcode version: 14.1
Swift version: 5.7
Package manager: Cocoapods
Steps to reproduce
Following enum in schema:
enum NumberOfStoriesEnum {
_1
_15
_2
_25
_3
}
Generated code:
public enum NumberOfStoriesEnum: String, EnumType {
case 1 = "_1"
case 15 = "_15"
case 2 = "_2"
case 25 = "_25"
case 3 = "_3"
}
As you can see, the case is just a number - which is not valid Swift code. In old code generator, the generated cases still had the underscore as a first character.
Note: If I change conversionStrategies.enumCases to .none - then it works, but it should work correctly with .camelCase as well, since it's mostly preferred strategy.
The text was updated successfully, but these errors were encountered:
ddanielczyk
changed the title
Numeric enums with underscore at beginning get invalid code generated.
Numeric enums with underscore at beginning get invalid code generated
Nov 4, 2022
Thanks for the bug report @ddanielczyk. I'll take a look into this next week.
Note: If I change conversionStrategies.enumCases to .none - then it works, but it should work correctly with .camelCase as well, since it's mostly preferred strategy.
Bug report
We recently started migration to new apollo-ios-cli code generation tool and something that was working before, with old code generator, is no longer working.
Versions
Please fill in the versions you're currently using:
apollo-ios
SDK version: 1.0.3Steps to reproduce
Following enum in schema:
Generated code:
As you can see, the case is just a number - which is not valid Swift code. In old code generator, the generated cases still had the underscore as a first character.
Note: If I change conversionStrategies.enumCases to .none - then it works, but it should work correctly with .camelCase as well, since it's mostly preferred strategy.
The text was updated successfully, but these errors were encountered: