Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sendable conformance to some basic SchemaTypes #322

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apollo-ios/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 apollo-ios/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 apollo-ios/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 apollo-ios/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
Loading