Skip to content

Commit 137f884

Browse files
committed
Fix @Entity macro
1 parent 12e579c commit 137f884

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/CoreModelMacros/Entity.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,11 @@ extension EntityMacro {
243243
}
244244
}
245245
}
246-
246+
247+
guard relationshipEntries.isEmpty == false else {
248+
return DeclSyntax(stringLiteral: #"public static var relationships: [CodingKeys: Relationship] { [:] }"#)
249+
}
250+
247251
let relationshipsDecl = """
248252
public static var relationships: [CodingKeys: Relationship] {
249253
[\n \(relationshipEntries.joined(separator: ",\n "))

0 commit comments

Comments
 (0)