Skip to content

Commit 44bdda7

Browse files
fix: Field resolvers are mutable
This allows us to modify resolvers after creation, making conversions between AST schemas (that have no resolvers) and executable schemas easier.
1 parent 5bee791 commit 44bdda7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Sources/GraphQL/Type/Definition.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,19 @@ public struct GraphQLResolveInfo: Sendable {
489489

490490
public typealias GraphQLFieldMap = OrderedDictionary<String, GraphQLField>
491491

492-
public struct GraphQLField: Sendable {
492+
public struct GraphQLField: @unchecked Sendable {
493493
public let type: GraphQLOutputType
494494
public let args: GraphQLArgumentConfigMap
495495
public let deprecationReason: String?
496496
public let description: String?
497-
public let resolve: GraphQLFieldResolve?
498-
public let subscribe: GraphQLFieldResolve?
497+
498+
/// The resolution logic of the field. This should not be mutated while the schema is being
499+
/// used.
500+
public var resolve: GraphQLFieldResolve?
501+
/// The subscription logic of the field. This should not be mutated while the schema is being
502+
/// used.
503+
public var subscribe: GraphQLFieldResolve?
504+
499505
public let astNode: FieldDefinition?
500506

501507
public init(

0 commit comments

Comments
 (0)