@@ -142,7 +142,7 @@ public struct SwiftAPIClientCallMacro: PeerMacro {
142142 }
143143}
144144
145- public struct SwiftAPIClientPathMacro : MemberMacro , MemberAttributeMacro , PeerMacro {
145+ public struct SwiftAPIClientPathMacro : MemberMacro , MemberAttributeMacro , PeerMacro , ExtensionMacro {
146146
147147 public static func expansion(
148148 of node: AttributeSyntax ,
@@ -157,6 +157,18 @@ public struct SwiftAPIClientPathMacro: MemberMacro, MemberAttributeMacro, PeerMa
157157 return [ " @available(*, unavailable) " , " @APICallFakeBuilder " ]
158158 }
159159
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+
160172 public static func expansion(
161173 of node: AttributeSyntax ,
162174 providingPeersOf declaration: some DeclSyntaxProtocol ,
0 commit comments