Skip to content

Commit

Permalink
Make GraphQLType conform to Hashable
Browse files Browse the repository at this point in the history
  • Loading branch information
lukel97 committed Jun 9, 2022
1 parent 3933850 commit 09d32c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/GraphQL/Type/Definition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NIO
/**
* These are all of the possible kinds of types.
*/
public protocol GraphQLType : CustomDebugStringConvertible, Encodable, KeySubscriptable, AnyObject, Equatable {}
public protocol GraphQLType : CustomDebugStringConvertible, Encodable, KeySubscriptable, AnyObject, Hashable {}
extension GraphQLScalarType : GraphQLType {}
extension GraphQLObjectType : GraphQLType {}
extension GraphQLInterfaceType : GraphQLType {}
Expand All @@ -16,7 +16,11 @@ extension GraphQLNonNull : GraphQLType {}

extension GraphQLType {
public static func == (lhs: Self, rhs: Self) -> Bool {
ObjectIdentifier(lhs) == ObjectIdentifier(rhs)
lhs === rhs
}

public func hash(into hasher: inout Hasher) {
ObjectIdentifier(self).hash(into: &hasher)
}
}

Expand Down

0 comments on commit 09d32c6

Please sign in to comment.