@@ -16,27 +16,14 @@ import Foundation
1616/// Extra context for the `safeForSwiftCode_` family of functions to produce more appropriate Swift identifiers.
1717struct SwiftNameOptions {
1818
19- /// An option for controlling capitalization.
20- ///
21- /// Generally, type names are capitalized, for example: `Foo`.
22- /// And member names are not capitalized, for example: `foo`.
23- enum Capitalization {
24-
25- /// Capitalize the name, used for type names, for example: `Foo`.
26- case capitalized
27-
28- /// Don't capitalize the name, used for member names, for example: `foo`.
29- case noncapitalized
30- }
31-
3219 /// The capitalization option.
33- var capitalization : Capitalization
20+ var isCapitalized : Bool
3421
3522 /// Preset options for capitalized names.
36- static let capitalized = SwiftNameOptions ( capitalization : . capitalized )
23+ static let capitalized = SwiftNameOptions ( isCapitalized : true )
3724
3825 /// Preset options for non-capitalized names.
39- static let noncapitalized = SwiftNameOptions ( capitalization : . noncapitalized )
26+ static let noncapitalized = SwiftNameOptions ( isCapitalized : false )
4027}
4128
4229extension String {
@@ -101,7 +88,7 @@ extension String {
10188 ///
10289 /// Check out [SOAR-0013](https://swiftpackageindex.com/apple/swift-openapi-generator/documentation/swift-openapi-generator/soar-0013) for details.
10390 func safeForSwiftCode_idiomatic( options: SwiftNameOptions ) -> String {
104- let capitalize = options. capitalization == . capitalized
91+ let capitalize = options. isCapitalized
10592 if isEmpty { return capitalize ? " _Empty_ " : " _empty_ " }
10693 // Detect cases like HELLO_WORLD, sometimes used for constants.
10794 let isAllUppercase = allSatisfy {
0 commit comments