Skip to content

Commit 065f4eb

Browse files
Fix macros (#18)
1 parent b7fa48b commit 065f4eb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Sources/SageSwiftKitMacros/CodableMacros/Builders/DecodeVariableBuild.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ struct DecodeVariableBuild {
186186
}
187187

188188
func buildStringOrInt(attribute: AttributeSyntax) -> CodeBlockItemSyntaxBuilder {
189-
guard type == "String" else {
189+
guard type == "String?" else {
190190
return buildBasicDecode()
191191
}
192192

@@ -221,7 +221,7 @@ struct DecodeVariableBuild {
221221
}
222222

223223
func buildStringOrDouble(attribute: AttributeSyntax) -> CodeBlockItemSyntaxBuilder {
224-
guard type == "String" else {
224+
guard type == "String?" else {
225225
return buildBasicDecode()
226226
}
227227

Tests/SageSwiftKitTests/CodableMacrosTests/CustomDecodableTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ final class CustomDecodableTests: XCTestCase {
136136
@CustomCodable
137137
struct PlayingObject {
138138
@StringOrInt
139-
var value: String
139+
var value: String?
140140
}
141141
""",
142142
expandedSource: """
143143
struct PlayingObject {
144-
var value: String
144+
var value: String?
145145
146146
enum CodingKeys: String, CodingKey {
147147
case value
@@ -180,12 +180,12 @@ final class CustomDecodableTests: XCTestCase {
180180
@CustomCodable
181181
struct PlayingObject {
182182
@StringOrDouble
183-
var value: String
183+
var value: String?
184184
}
185185
""",
186186
expandedSource: """
187187
struct PlayingObject {
188-
var value: String
188+
var value: String?
189189
190190
enum CodingKeys: String, CodingKey {
191191
case value

0 commit comments

Comments
 (0)