-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: update the implementation of CapitalizationRule to be more f…
…lexible
- Loading branch information
1 parent
8272e9f
commit 0cda6f0
Showing
2 changed files
with
26 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 20 additions & 6 deletions
26
apollo-ios-codegen/Sources/ApolloCodegenLib/Capitalizer.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
import Foundation | ||
|
||
public enum CapitalizationRule: Codable, Equatable { | ||
case uppercase(regex: String) | ||
case lowercase(regex: String) | ||
case titlecase(regex: String) | ||
case camelcase(regex: String) | ||
case pascalcase(regex: String) | ||
public struct CapitalizationRule: Codable, Equatable, Sendable { | ||
public enum Term: Codable, Equatable, Sendable { | ||
case string(String) | ||
case regex(String) | ||
} | ||
|
||
public enum CaseStrategy: String, Codable, Equatable, Sendable { | ||
case upper | ||
case lower | ||
case camel | ||
case pascal | ||
} | ||
|
||
public let term: Term | ||
public let strategy: CaseStrategy | ||
|
||
public init(term: Term, strategy: CaseStrategy) { | ||
self.term = term | ||
self.strategy = strategy | ||
} | ||
} |