Skip to content

Commit 93f74c9

Browse files
author
Karthikeya Udupa KM
authored
Merge pull request #99 from RomanPodymov/master
Don't set rawValue for a case if it is the same as it's name
2 parents 67a1a64 + 939d088 commit 93f74c9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
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

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (2.3.6)
4+
CFPropertyList (3.0.0)
55
activesupport (4.2.11.1)
66
i18n (~> 0.7)
77
minitest (~> 5.1)

0 commit comments

Comments
 (0)