Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added escaping to result closure #1292

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions Sources/Kitura/CodableRouter+TypeSafeMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extension Router {
*/
public func get<T: TypeSafeMiddleware, O: Codable>(
_ route: String,
handler: @escaping (T, CodableResultClosure<O>) -> Void
handler: @escaping (T, @escaping CodableResultClosure<O>) -> Void
) {
registerGetRoute(route: route, id: false, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -86,7 +86,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, @escaping CodableResultClosure<O>) -> Void
) {
registerGetRoute(route: route, id: false, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -121,7 +121,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, T3, @escaping CodableResultClosure<O>) -> Void
) {
registerGetRoute(route: route, id: false, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -161,7 +161,7 @@ extension Router {
*/
public func get<T: TypeSafeMiddleware, O: Codable>(
_ route: String,
handler: @escaping (T, CodableArrayResultClosure<O>) -> Void
handler: @escaping (T, @escaping CodableArrayResultClosure<O>) -> Void
) {
registerGetRoute(route: route, id: false, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -196,7 +196,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, CodableArrayResultClosure<O>) -> Void
handler: @escaping (T1, T2, @escaping CodableArrayResultClosure<O>) -> Void
) {
registerGetRoute(route: route, id: false, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -231,7 +231,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, CodableArrayResultClosure<O>) -> Void
handler: @escaping (T1, T2, T3, @escaping CodableArrayResultClosure<O>) -> Void
) {
registerGetRoute(route: route, id: false, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -271,7 +271,7 @@ extension Router {
*/
public func get<T: TypeSafeMiddleware, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T, Id, CodableResultClosure<O>) -> Void
handler: @escaping (T, Id, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -313,7 +313,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, Id, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, Id, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -355,7 +355,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, Id, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, T3, Id, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -402,7 +402,7 @@ extension Router {
*/
public func get<T: TypeSafeMiddleware, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T, IdentifierCodableArrayResultClosure<Id, O>) -> Void
handler: @escaping (T, @escaping IdentifierCodableArrayResultClosure<Id, O>) -> Void
) {
registerGetRoute(route: route, id: true, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -437,7 +437,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, IdentifierCodableArrayResultClosure<Id, O>) -> Void
handler: @escaping (T1, T2, @escaping IdentifierCodableArrayResultClosure<Id, O>) -> Void
) {
registerGetRoute(route: route, id: true, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -472,7 +472,7 @@ extension Router {
*/
public func get<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, IdentifierCodableArrayResultClosure<Id, O>) -> Void
handler: @escaping (T1, T2, T3, @escaping IdentifierCodableArrayResultClosure<Id, O>) -> Void
) {
registerGetRoute(route: route, id: true, outputtype: O.self)
get(route) { request, response, next in
Expand Down Expand Up @@ -798,7 +798,7 @@ extension Router {
*/
public func delete<T: TypeSafeMiddleware>(
_ route: String,
handler: @escaping (T, ResultClosure) -> Void
handler: @escaping (T, @escaping ResultClosure) -> Void
) {
registerDeleteRoute(route: route, id: false)
delete(route) { request, response, next in
Expand Down Expand Up @@ -831,7 +831,7 @@ extension Router {
*/
public func delete<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware>(
_ route: String,
handler: @escaping (T1, T2, ResultClosure) -> Void
handler: @escaping (T1, T2, @escaping ResultClosure) -> Void
) {
registerDeleteRoute(route: route, id: false)
delete(route) { request, response, next in
Expand Down Expand Up @@ -864,7 +864,7 @@ extension Router {
*/
public func delete<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware>(
_ route: String,
handler: @escaping (T1, T2, T3, ResultClosure) -> Void
handler: @escaping (T1, T2, T3, @escaping ResultClosure) -> Void
) {
registerDeleteRoute(route: route, id: false)
delete(route) { request, response, next in
Expand Down Expand Up @@ -902,7 +902,7 @@ extension Router {
*/
public func delete<T: TypeSafeMiddleware, Id: Identifier>(
_ route: String,
handler: @escaping (T, Id, ResultClosure) -> Void
handler: @escaping (T, Id, @escaping ResultClosure) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -942,7 +942,7 @@ extension Router {
*/
public func delete<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Id: Identifier>(
_ route: String,
handler: @escaping (T1, T2, Id, ResultClosure) -> Void
handler: @escaping (T1, T2, Id, @escaping ResultClosure) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -982,7 +982,7 @@ extension Router {
*/
public func delete<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Id: Identifier>(
_ route: String,
handler: @escaping (T1, T2, T3, Id, ResultClosure) -> Void
handler: @escaping (T1, T2, T3, Id, @escaping ResultClosure) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -1168,7 +1168,7 @@ extension Router {
*/
public func post<T: TypeSafeMiddleware, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T, I, CodableResultClosure<O>) -> Void
handler: @escaping (T, I, @escaping CodableResultClosure<O>) -> Void
) {
registerPostRoute(route: route, id: false, inputtype: I.self, outputtype: O.self)
post(route) { request, response, next in
Expand Down Expand Up @@ -1209,7 +1209,7 @@ extension Router {
*/
public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, I, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, I, @escaping CodableResultClosure<O>) -> Void
) {
registerPostRoute(route: route, id: false, inputtype: I.self, outputtype: O.self)
post(route) { request, response, next in
Expand Down Expand Up @@ -1250,7 +1250,7 @@ extension Router {
*/
public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, I, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, T3, I, @escaping CodableResultClosure<O>) -> Void
) {
registerPostRoute(route: route, id: false, inputtype: I.self, outputtype: O.self)
post(route) { request, response, next in
Expand Down Expand Up @@ -1293,7 +1293,7 @@ extension Router {
*/
public func post<T: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T, I, IdentifierCodableResultClosure<Id, O>) -> Void
handler: @escaping (T, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
) {
registerPostRoute(route: route, id: true, inputtype: I.self, outputtype: O.self)
post(route) { request, response, next in
Expand Down Expand Up @@ -1331,7 +1331,7 @@ extension Router {
*/
public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, I, IdentifierCodableResultClosure<Id, O>) -> Void
handler: @escaping (T1, T2, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
) {
registerPostRoute(route: route, id: true, inputtype: I.self, outputtype: O.self)
post(route) { request, response, next in
Expand Down Expand Up @@ -1369,7 +1369,7 @@ extension Router {
*/
public func post<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, I: Codable, Id: Identifier, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, I, IdentifierCodableResultClosure<Id, O>) -> Void
handler: @escaping (T1, T2, T3, I, @escaping IdentifierCodableResultClosure<Id, O>) -> Void
) {
registerPostRoute(route: route, id: true, inputtype: I.self, outputtype: O.self)
post(route) { request, response, next in
Expand Down Expand Up @@ -1410,7 +1410,7 @@ extension Router {
*/
public func put<T: TypeSafeMiddleware, Id: Identifier, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T, Id, I, CodableResultClosure<O>) -> Void
handler: @escaping (T, Id, I, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -1452,7 +1452,7 @@ extension Router {
*/
public func put<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Id: Identifier, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, Id, I, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, Id, I, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -1494,7 +1494,7 @@ extension Router {
*/
public func put<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Id: Identifier, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, Id, I, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, T3, Id, I, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -1546,7 +1546,7 @@ extension Router {
*/
public func patch<T: TypeSafeMiddleware, Id: Identifier, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T, Id, I, CodableResultClosure<O>) -> Void
handler: @escaping (T, Id, I, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -1594,7 +1594,7 @@ extension Router {
*/
public func patch<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, Id: Identifier, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, Id, I, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, Id, I, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down Expand Up @@ -1642,7 +1642,7 @@ extension Router {
*/
public func patch<T1: TypeSafeMiddleware, T2: TypeSafeMiddleware, T3: TypeSafeMiddleware, Id: Identifier, I: Codable, O: Codable>(
_ route: String,
handler: @escaping (T1, T2, T3, Id, I, CodableResultClosure<O>) -> Void
handler: @escaping (T1, T2, T3, Id, I, @escaping CodableResultClosure<O>) -> Void
) {
if parameterIsPresent(in: route) {
return
Expand Down