Skip to content

Commit

Permalink
Add Sendable conformance to some basic SchemaTypes (apollographql/apo…
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbergeron authored and gh-action-runner committed Apr 2, 2024
1 parent d126608 commit 4851f15
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Sources/ApolloAPI/GraphQLOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum GraphQLOperationType: Hashable {
/// ``GraphQLOperation``. You can configure the the code generation engine to include the
/// ``OperationDefinition``, ``operationIdentifier``, or both using the `OperationDocumentFormat`
/// options in your `ApolloCodegenConfiguration`.
public struct OperationDocument {
public struct OperationDocument: Sendable {
public let operationIdentifier: String?
public let definition: OperationDefinition?

Expand All @@ -35,7 +35,7 @@ public struct OperationDocument {
/// This data represents the `Definition` for a `Document` as defined in the GraphQL Spec.
/// In the case of the Apollo client, the definition will always be an `ExecutableDefinition`.
/// - See: [GraphQLSpec - Document](https://spec.graphql.org/draft/#Document)
public struct OperationDefinition {
public struct OperationDefinition: Sendable {
let operationDefinition: String
let fragments: [any Fragment.Type]?

Expand Down
2 changes: 1 addition & 1 deletion Sources/ApolloAPI/SchemaTypes/Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// # See Also
/// [GraphQLSpec - Interfaces](https://spec.graphql.org/draft/#sec-Interfaces)
public struct Interface: Hashable {
public struct Interface: Hashable, Sendable {
/// The name of the ``Interface`` in the GraphQL schema.
public let name: String

Expand Down
12 changes: 1 addition & 11 deletions Sources/ApolloAPI/SchemaTypes/Object.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// Each `type` defined in the GraphQL schema will have an instance of ``Object`` generated.
/// # See Also
/// [GraphQLSpec - Objects](https://spec.graphql.org/draft/#sec-Objects)
public struct Object: Hashable {
public struct Object: Hashable, Sendable {

/// Designated Initializer
///
Expand Down Expand Up @@ -34,14 +34,4 @@ public struct Object: Hashable {
public func implements(_ interface: Interface) -> Bool {
implementedInterfaces.contains(where: { $0 == interface })
}

public static func == (lhs: Object, rhs: Object) -> Bool {
return lhs.typename == rhs.typename &&
lhs.implementedInterfaces == rhs.implementedInterfaces
}

public func hash(into hasher: inout Hasher) {
hasher.combine(typename)
hasher.combine(implementedInterfaces)
}
}
2 changes: 1 addition & 1 deletion Sources/ApolloAPI/SchemaTypes/Union.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
///
/// # See Also
/// [GraphQLSpec - Unions](https://spec.graphql.org/draft/#sec-Unions)
public struct Union: Hashable {
public struct Union: Hashable, Sendable {
/// The name of the ``Union`` in the GraphQL schema.
public let name: String

Expand Down

0 comments on commit 4851f15

Please sign in to comment.