Skip to content

Commit

Permalink
change up handler method
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuawright11 committed Jun 5, 2024
1 parent 2b610b7 commit e2d08f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Papyrus/Sources/PapyrusMacros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
@attached(peer, names: suffixed(API))
public macro API() = #externalMacro(module: "PapyrusPlugin", type: "APIMacro")

@attached(extension, names: named(useAPI))
@attached(extension, names: named(registerHandlers))
@attached(peer, names: suffixed(Live), suffixed(Routes))
public macro Routes() = #externalMacro(module: "PapyrusPlugin", type: "RoutesMacro")

Expand Down
2 changes: 1 addition & 1 deletion PapyrusPlugin/Sources/Macros/APIMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension API {

// 2. builder used by all live endpoint functions

Declaration("func builder(method: String, path: String) -> RequestBuilder") {
Declaration("func builder(method: String, path: String) -> Papyrus.RequestBuilder") {
if attributes.isEmpty {
"provider.newBuilder(method: method, path: path)"
} else {
Expand Down
6 changes: 3 additions & 3 deletions PapyrusPlugin/Sources/Macros/RoutesMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ extension API {
}

func routesExtension() -> Declaration {
Declaration("extension \(name) where Self: PapyrusRouter") {
Declaration("func useAPI(_ api: (any \(name)).Type)") {
"\(name)Routes.register(api: self, router: self)"
Declaration("extension \(name)") {
Declaration("func registerHandlers(_ of: (any \(name)).Type = \(name).self, on router: PapyrusRouter)") {
"\(name)Routes.register(api: self, router: router)"
}
}
.access(access)
Expand Down

0 comments on commit e2d08f1

Please sign in to comment.