Skip to content

Commit 7010f33

Browse files
Made all validate function and ValidationContext public
1 parent 283cc4d commit 7010f33

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/GraphQL/Validation/SpecifiedRules.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* This set includes all validation rules defined by the GraphQL spec.
33
*/
4-
let specifiedRules: [(ValidationContext) -> Visitor] = [
4+
public let specifiedRules: [(ValidationContext) -> Visitor] = [
55
// UniqueOperationNames,
66
// LoneAnonymousOperation,
77
// KnownTypeNames,

Sources/GraphQL/Validation/Validate.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ func visit(
6262
return context.errors
6363
}
6464

65-
enum HasSelectionSet {
65+
public enum HasSelectionSet {
6666
case operation(OperationDefinition)
6767
case fragment(FragmentDefinition)
6868

69-
var node: Node {
69+
public var node: Node {
7070
switch self {
7171
case .operation(let operation):
7272
return operation
@@ -77,7 +77,7 @@ enum HasSelectionSet {
7777
}
7878

7979
extension HasSelectionSet : Hashable {
80-
func hash(into hasher: inout Hasher) {
80+
public func hash(into hasher: inout Hasher) {
8181
switch self {
8282
case .operation(let operation):
8383
return hasher.combine(operation.hashValue)
@@ -86,7 +86,7 @@ extension HasSelectionSet : Hashable {
8686
}
8787
}
8888

89-
static func == (lhs: HasSelectionSet, rhs: HasSelectionSet) -> Bool {
89+
public static func == (lhs: HasSelectionSet, rhs: HasSelectionSet) -> Bool {
9090
switch (lhs, rhs) {
9191
case (.operation(let l), .operation(let r)):
9292
return l == r
@@ -98,15 +98,15 @@ extension HasSelectionSet : Hashable {
9898
}
9999
}
100100

101-
typealias VariableUsage = (node: Variable, type: GraphQLInputType?)
101+
public typealias VariableUsage = (node: Variable, type: GraphQLInputType?)
102102

103103
/**
104104
* An instance of this class is passed as the "this" context to all validators,
105105
* allowing access to commonly useful contextual information from within a
106106
* validation rule.
107107
*/
108-
final class ValidationContext {
109-
let schema: GraphQLSchema
108+
public final class ValidationContext {
109+
public let schema: GraphQLSchema
110110
let ast: Document
111111
let typeInfo: TypeInfo
112112
var errors: [GraphQLError]
@@ -128,11 +128,11 @@ final class ValidationContext {
128128
self.recursiveVariableUsages = [:]
129129
}
130130

131-
func report(error: GraphQLError) {
131+
public func report(error: GraphQLError) {
132132
errors.append(error)
133133
}
134134

135-
func getFragment(name: String) -> FragmentDefinition? {
135+
public func getFragment(name: String) -> FragmentDefinition? {
136136
var fragments = self.fragments
137137

138138
if fragments.isEmpty {
@@ -152,7 +152,7 @@ final class ValidationContext {
152152
return fragments[name]
153153
}
154154

155-
func getFragmentSpreads(node: SelectionSet) -> [FragmentSpread] {
155+
public func getFragmentSpreads(node: SelectionSet) -> [FragmentSpread] {
156156
var spreads = fragmentSpreads[node]
157157

158158
if spreads == nil {
@@ -181,7 +181,7 @@ final class ValidationContext {
181181
return spreads!
182182
}
183183

184-
func getRecursivelyReferencedFragments(operation: OperationDefinition) -> [FragmentDefinition] {
184+
public func getRecursivelyReferencedFragments(operation: OperationDefinition) -> [FragmentDefinition] {
185185
var fragments = recursivelyReferencedFragments[operation]
186186

187187
if fragments == nil {
@@ -210,7 +210,7 @@ final class ValidationContext {
210210
return fragments!
211211
}
212212

213-
func getVariableUsages(node: HasSelectionSet) -> [VariableUsage] {
213+
public func getVariableUsages(node: HasSelectionSet) -> [VariableUsage] {
214214
var usages = variableUsages[node]
215215

216216
if usages == nil {
@@ -236,7 +236,7 @@ final class ValidationContext {
236236
return usages!
237237
}
238238

239-
func getRecursiveVariableUsages(operation: OperationDefinition) -> [VariableUsage] {
239+
public func getRecursiveVariableUsages(operation: OperationDefinition) -> [VariableUsage] {
240240
var usages = recursiveVariableUsages[operation]
241241

242242
if usages == nil {
@@ -254,27 +254,27 @@ final class ValidationContext {
254254
return usages!
255255
}
256256

257-
var type: GraphQLOutputType? {
257+
public var type: GraphQLOutputType? {
258258
return typeInfo.type
259259
}
260260

261-
var parentType: GraphQLCompositeType? {
261+
public var parentType: GraphQLCompositeType? {
262262
return typeInfo.parentType
263263
}
264264

265-
var inputType: GraphQLInputType? {
265+
public var inputType: GraphQLInputType? {
266266
return typeInfo.inputType
267267
}
268268

269-
var fieldDef: GraphQLFieldDefinition? {
269+
public var fieldDef: GraphQLFieldDefinition? {
270270
return typeInfo.fieldDef
271271
}
272272

273-
var directive: GraphQLDirective? {
273+
public var directive: GraphQLDirective? {
274274
return typeInfo.directive
275275
}
276276

277-
var argument: GraphQLArgumentDefinition? {
277+
public var argument: GraphQLArgumentDefinition? {
278278
return typeInfo.argument
279279
}
280280
}

0 commit comments

Comments
 (0)