Skip to content

Commit

Permalink
Merge pull request #126 from cshadek/public_no_arguments
Browse files Browse the repository at this point in the history
Made inits public for NoArguments and PageInfo
  • Loading branch information
NeedleInAJayStack committed Oct 25, 2023
2 parents daa556a + d031797 commit 09b3c37
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Sources/Graphiti/Argument/NoArguments.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
public struct NoArguments: Decodable {
init() {}
public init() {}
}
12 changes: 12 additions & 0 deletions Sources/Graphiti/Connection/PageInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,16 @@ public struct PageInfo: Codable {
public let hasNextPage: Bool
public let startCursor: String?
public let endCursor: String?

public init(
hasPreviousPage: Bool,
hasNextPage: Bool,
startCursor: String? = nil,
endCursor: String? = nil
) {
self.hasPreviousPage = hasPreviousPage
self.hasNextPage = hasNextPage
self.startCursor = startCursor
self.endCursor = endCursor
}
}
28 changes: 13 additions & 15 deletions Tests/GraphitiTests/ConnectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,23 @@ class ConnectionTests: XCTestCase {
}
}

let schema = {
try! Schema<ConnectionTypeResolver, NoContext> {
Type(Comment.self) {
Field("id", at: \.id)
Field("message", at: \.message)
}
let schema = try! Schema<ConnectionTypeResolver, NoContext> {
Type(Comment.self) {
Field("id", at: \.id)
Field("message", at: \.message)
}

ConnectionType(Comment.self)
ConnectionType(Comment.self)

Query {
Field("comments", at: ConnectionTypeResolver.comments) {
Argument("first", at: \.first)
Argument("last", at: \.last)
Argument("after", at: \.after)
Argument("before", at: \.before)
}
Query {
Field("comments", at: ConnectionTypeResolver.comments) {
Argument("first", at: \.first)
Argument("last", at: \.last)
Argument("after", at: \.after)
Argument("before", at: \.before)
}
}
}()
}

let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)

Expand Down

0 comments on commit 09b3c37

Please sign in to comment.