Skip to content

Commit 7729118

Browse files
feature: Drops unnecessary codable requirements
1 parent 742dba5 commit 7729118

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

Sources/Graphiti/Connection/Connection.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22
import GraphQL
33
import NIO
44

5-
public struct Connection<Node: Encodable>: Encodable {
5+
public struct Connection<Node> {
66
public let edges: [Edge<Node>]
77
public let pageInfo: PageInfo
88
}
@@ -19,7 +19,7 @@ public extension Connection where Node: Identifiable, Node.ID: LosslessStringCon
1919
}
2020

2121
@available(macOS 10.15, macCatalyst 13.0, iOS 13.0, tvOS 13, watchOS 6.0, *) // For Identifiable
22-
public extension EventLoopFuture where Value: Sequence, Value.Element: Encodable & Identifiable,
22+
public extension EventLoopFuture where Value: Sequence, Value.Element: Identifiable,
2323
Value.Element.ID: LosslessStringConvertible {
2424
func connection(from arguments: Paginatable) -> EventLoopFuture<Connection<Value.Element>> {
2525
connection(from: arguments, makeCursor: Connection<Value.Element>.cursor)
@@ -36,7 +36,7 @@ Value.Element.ID: LosslessStringConvertible {
3636
}
3737
}
3838

39-
public extension EventLoopFuture where Value: Sequence, Value.Element: Encodable {
39+
public extension EventLoopFuture where Value: Sequence {
4040
func connection(
4141
from arguments: Paginatable,
4242
makeCursor: @escaping (Value.Element) throws -> String
@@ -66,7 +66,7 @@ public extension EventLoopFuture where Value: Sequence, Value.Element: Encodable
6666
}
6767

6868
@available(macOS 10.15, macCatalyst 13.0, iOS 13.0, tvOS 13, watchOS 6.0, *) // For Identifiable
69-
public extension Sequence where Element: Encodable & Identifiable,
69+
public extension Sequence where Element: Identifiable,
7070
Element.ID: LosslessStringConvertible {
7171
func connection(from arguments: Paginatable) throws -> Connection<Element> {
7272
try connection(from: arguments, makeCursor: Connection<Element>.cursor)
@@ -81,7 +81,7 @@ Element.ID: LosslessStringConvertible {
8181
}
8282
}
8383

84-
public extension Sequence where Element: Encodable {
84+
public extension Sequence {
8585
func connection(
8686
from arguments: Paginatable,
8787
makeCursor: @escaping (Element) throws -> String
@@ -120,7 +120,7 @@ func connect<Node>(
120120
to elements: [Node],
121121
arguments: PaginationArguments,
122122
makeCursor: @escaping (Node) throws -> String
123-
) throws -> Connection<Node> where Node: Encodable {
123+
) throws -> Connection<Node> {
124124
let edges = try elements.map { element in
125125
// swiftformat:disable:next hoistTry
126126
Edge<Node>(node: element, cursor: try makeCursor(element))
@@ -140,7 +140,7 @@ func connect<Node>(
140140
)
141141
}
142142

143-
func slicingCursor<Node: Encodable>(
143+
func slicingCursor<Node>(
144144
edges: [Edge<Node>],
145145
arguments: PaginationArguments
146146
) -> ArraySlice<Edge<Node>> {
@@ -166,7 +166,7 @@ func slicingCursor<Node: Encodable>(
166166
return edges
167167
}
168168

169-
func slicingCount<Node: Encodable>(
169+
func slicingCount<Node>(
170170
edges: ArraySlice<Edge<Node>>,
171171
arguments: PaginationArguments
172172
) throws -> [Edge<Node>] {
@@ -195,7 +195,7 @@ func slicingCount<Node: Encodable>(
195195
return Array(edges)
196196
}
197197

198-
func hasPreviousPage<Node: Encodable>(
198+
func hasPreviousPage<Node>(
199199
edges: ArraySlice<Edge<Node>>,
200200
arguments: PaginationArguments
201201
) -> Bool {
@@ -206,7 +206,7 @@ func hasPreviousPage<Node: Encodable>(
206206
return false
207207
}
208208

209-
func hasNextPage<Node: Encodable>(
209+
func hasNextPage<Node>(
210210
edges: ArraySlice<Edge<Node>>,
211211
arguments: PaginationArguments
212212
) -> Bool {

Sources/Graphiti/Connection/ConnectionType.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import GraphQL
33
public final class ConnectionType<
44
Resolver,
55
Context,
6-
ObjectType: Encodable
6+
ObjectType
77
>: TypeComponent<
88
Resolver,
99
Context
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
protocol Edgeable {
2-
associatedtype Node: Encodable
2+
associatedtype Node
33
var node: Node { get }
44
var cursor: String { get }
55
}
66

7-
public struct Edge<Node: Encodable>: Edgeable, Encodable {
7+
public struct Edge<Node>: Edgeable {
88
public let node: Node
99
public let cursor: String
1010
}

Sources/Graphiti/Field/Field/Field.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public class Field<ObjectType, Context, FieldType, Arguments: Decodable>: FieldC
112112

113113
// MARK: AsyncResolve Initializers
114114

115-
public extension Field where FieldType: Encodable {
115+
public extension Field {
116116
convenience init(
117117
_ name: String,
118118
at function: @escaping AsyncResolve<ObjectType, Context, Arguments, FieldType>,
@@ -154,7 +154,7 @@ public extension Field {
154154

155155
// MARK: SimpleAsyncResolve Initializers
156156

157-
public extension Field where FieldType: Encodable {
157+
public extension Field {
158158
convenience init(
159159
_ name: String,
160160
at function: @escaping SimpleAsyncResolve<ObjectType, Context, Arguments, FieldType>,
@@ -196,7 +196,7 @@ public extension Field {
196196

197197
// MARK: SyncResolve Initializers
198198

199-
public extension Field where FieldType: Encodable {
199+
public extension Field {
200200
convenience init(
201201
_ name: String,
202202
at function: @escaping SyncResolve<ObjectType, Context, Arguments, FieldType>,
@@ -298,7 +298,7 @@ public extension Field where Arguments == NoArguments {
298298

299299
// MARK: ConcurrentResolve Initializers
300300

301-
public extension Field where FieldType: Encodable {
301+
public extension Field {
302302
@available(macOS 10.15, iOS 15, watchOS 8, tvOS 15, *)
303303
convenience init(
304304
_ name: String,

Sources/Graphiti/Input/Input.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import GraphQL
33
public final class Input<
44
Resolver,
55
Context,
6-
InputObjectType: Decodable
6+
InputObjectType
77
>: TypeComponent<
88
Resolver,
99
Context

Sources/Graphiti/Subscription/SubscribeField.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public class SubscriptionField<
263263

264264
// MARK: AsyncResolve Initializers
265265

266-
public extension SubscriptionField where FieldType: Encodable {
266+
public extension SubscriptionField {
267267
convenience init(
268268
_ name: String,
269269
at function: @escaping AsyncResolve<SourceEventType, Context, Arguments, FieldType>,
@@ -376,7 +376,7 @@ public extension SubscriptionField {
376376

377377
// MARK: SimpleAsyncResolve Initializers
378378

379-
public extension SubscriptionField where FieldType: Encodable {
379+
public extension SubscriptionField {
380380
convenience init(
381381
_ name: String,
382382
at function: @escaping SimpleAsyncResolve<SourceEventType, Context, Arguments, FieldType>,
@@ -491,7 +491,7 @@ public extension SubscriptionField {
491491

492492
// MARK: SyncResolve Initializers
493493

494-
public extension SubscriptionField where FieldType: Encodable {
494+
public extension SubscriptionField {
495495
convenience init(
496496
_ name: String,
497497
at function: @escaping SyncResolve<SourceEventType, Context, Arguments, FieldType>,
@@ -680,7 +680,7 @@ public extension SubscriptionField {
680680

681681
// MARK: ConcurrentResolve Initializers
682682

683-
public extension SubscriptionField where FieldType: Encodable {
683+
public extension SubscriptionField {
684684
@available(macOS 10.15, iOS 15, watchOS 8, tvOS 15, *)
685685
convenience init(
686686
_ name: String,

Sources/Graphiti/Type/Type.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import GraphQL
22

3-
public final class Type<Resolver, Context, ObjectType: Encodable>: TypeComponent<
3+
public final class Type<Resolver, Context, ObjectType>: TypeComponent<
44
Resolver,
55
Context
66
> {

0 commit comments

Comments
 (0)