Skip to content

Commit 36f48a8

Browse files
authored
Don't set rawValue for a case if it is the same as it's name
1 parent 67a1a64 commit 36f48a8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Core/Generator/Model-File-Components/SwiftJSONModelFile.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ struct SwiftJSONModelFile: ModelFile {
5757
/// - Returns: Returns `case <constant> = "value"`.
5858
func genStringConstant(_ constantName: String, _ value: String) -> String {
5959
let component = constantName.components(separatedBy: ".")
60-
return "case \(component.last!) = \"\(value)\""
60+
let caseName = component.last!
61+
return "case \(caseName)" + (caseName == value ? "" : " = \"\(value)\"")
6162
}
6263

6364
/// Generate the variable declaration string

0 commit comments

Comments
 (0)