@@ -142,7 +142,7 @@ public struct SwiftAPIClientCallMacro: PeerMacro {
142
142
}
143
143
}
144
144
145
- public struct SwiftAPIClientPathMacro : MemberMacro , MemberAttributeMacro , PeerMacro {
145
+ public struct SwiftAPIClientPathMacro : MemberMacro , MemberAttributeMacro , PeerMacro , ExtensionMacro {
146
146
147
147
public static func expansion(
148
148
of node: AttributeSyntax ,
@@ -157,6 +157,18 @@ public struct SwiftAPIClientPathMacro: MemberMacro, MemberAttributeMacro, PeerMa
157
157
return [ " @available(*, unavailable) " , " @APICallFakeBuilder " ]
158
158
}
159
159
160
+ public static func expansion(
161
+ of node: AttributeSyntax ,
162
+ attachedTo declaration: some DeclGroupSyntax ,
163
+ providingExtensionsOf type: some TypeSyntaxProtocol ,
164
+ conformingTo protocols: [ TypeSyntax ] ,
165
+ in context: some MacroExpansionContext
166
+ ) throws -> [ ExtensionDeclSyntax ] {
167
+ guard declaration. is ( StructDeclSyntax . self) || declaration. is ( EnumDeclSyntax . self) else { return [ ] }
168
+ let scopeExtension = try ExtensionDeclSyntax ( " extension \( type. trimmed) : APIClientScope {} " )
169
+ return [ scopeExtension]
170
+ }
171
+
160
172
public static func expansion(
161
173
of node: AttributeSyntax ,
162
174
providingPeersOf declaration: some DeclSyntaxProtocol ,
0 commit comments