Skip to content

Commit 6d58c31

Browse files
fix: Field resolvers are mutable
This allows us to modify resolvers, which improves our ability to set resolvers after creation, making conversions between AST schemas (that have no resolvers) and executable schemas easier.
1 parent 5bee791 commit 6d58c31

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Sources/GraphQL/Type/Definition.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,17 @@ 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 used.
499+
public var resolve: GraphQLFieldResolve?
500+
/// The subscription logic of the field. This should not be mutated while the schema is being used.
501+
public var subscribe: GraphQLFieldResolve?
502+
499503
public let astNode: FieldDefinition?
500504

501505
public init(

0 commit comments

Comments
 (0)