Skip to content

Commit 13fe373

Browse files
docs: Removes public from docs
1 parent 4740447 commit 13fe373

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

Examples/HelloWorldServer/Sources/HelloWorldServer/Resolvers.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import GraphQL
33
import GraphQLGeneratorRuntime
44

55
// Must be created by user and named `GraphQLContext`.
6-
public class GraphQLContext: @unchecked Sendable {
6+
class GraphQLContext: @unchecked Sendable {
77
// User can choose structure
88
var users: [String: User]
99
var posts: [String: Post]
@@ -23,28 +23,28 @@ public class GraphQLContext: @unchecked Sendable {
2323
}
2424

2525
// Scalars must be represented by a Swift type of the same name, conforming to the Scalar protocol
26-
public struct EmailAddress: GraphQLScalar {
26+
struct EmailAddress: GraphQLScalar {
2727
let email: String
2828

2929
init(email: String) {
3030
self.email = email
3131
}
3232

3333
// Codability conformance. Required for usage in InputObject
34-
public init(from decoder: any Decoder) throws {
34+
init(from decoder: any Decoder) throws {
3535
email = try decoder.singleValueContainer().decode(String.self)
3636
}
3737

38-
public func encode(to encoder: any Encoder) throws {
38+
func encode(to encoder: any Encoder) throws {
3939
try email.encode(to: encoder)
4040
}
4141

4242
// Scalar conformance. Not necessary, but default methods are very inefficient.
43-
public static func serialize(this: Self) throws -> Map {
43+
static func serialize(this: Self) throws -> Map {
4444
return .string(this.email)
4545
}
4646

47-
public static func parseValue(map: Map) throws -> Map {
47+
static func parseValue(map: Map) throws -> Map {
4848
switch map {
4949
case .string:
5050
return map
@@ -53,7 +53,7 @@ public struct EmailAddress: GraphQLScalar {
5353
}
5454
}
5555

56-
public static func parseLiteral(value: any Value) throws -> Map {
56+
static func parseLiteral(value: any Value) throws -> Map {
5757
guard let ast = value as? StringValue else {
5858
throw GraphQLError(
5959
message: "EmailAddress cannot represent non-string value: \(print(ast: value))",

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ When you build, the plugin will automatically generate Swift code that you can v
6363
Create a type named `GraphQLContext`:
6464

6565
```swift
66-
public actor GraphQLContext {
66+
actor GraphQLContext {
6767
// Add any features you like
6868
}
6969
```
@@ -137,7 +137,7 @@ type A {
137137

138138
This would result in the following protocol:
139139
```swift
140-
public protocol A: Sendable {
140+
protocol A: Sendable {
141141
func foo(context: GraphQLContext, info: GraphQLResolveInfo) async throws -> String
142142
}
143143
```
@@ -177,34 +177,34 @@ Scalar types are not modeled by the generator. They are simply referenced using
177177
Below is an example that represents a scalar struct as a raw String:
178178

179179
```swift
180-
public struct EmailAddress: GraphQLScalar {
180+
struct EmailAddress: GraphQLScalar {
181181
let email: String
182182

183183
init(email: String) {
184184
self.email = email
185185
}
186186

187187
// Codability conformance. Represent simply as `email` string.
188-
public init(from decoder: any Decoder) throws {
188+
init(from decoder: any Decoder) throws {
189189
self.email = try decoder.singleValueContainer().decode(String.self)
190190
}
191-
public func encode(to encoder: any Encoder) throws {
191+
func encode(to encoder: any Encoder) throws {
192192
try self.email.encode(to: encoder)
193193
}
194194

195195
// Scalar conformance. Parse & serialize simply as `email` string.
196-
public static func serialize(this: Self) throws -> Map {
196+
static func serialize(this: Self) throws -> Map {
197197
return .string(this.email)
198198
}
199-
public static func parseValue(map: Map) throws -> Map {
199+
static func parseValue(map: Map) throws -> Map {
200200
switch map {
201201
case .string:
202202
return map
203203
default:
204204
throw GraphQLError(message: "EmailAddress cannot represent non-string value: \(map)")
205205
}
206206
}
207-
public static func parseLiteral(value: any Value) throws -> Map {
207+
static func parseLiteral(value: any Value) throws -> Map {
208208
guard let ast = value as? StringValue else {
209209
throw GraphQLError(
210210
message: "EmailAddress cannot represent non-string value: \(print(ast: value))",

0 commit comments

Comments
 (0)