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

Adding debugDescription to SelectionSets #412

Merged
merged 1 commit into from
Jul 2, 2024
Merged
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
6 changes: 5 additions & 1 deletion apollo-ios/Sources/ApolloAPI/SelectionSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public protocol CompositeInlineFragment: CompositeSelectionSet, InlineFragment {
}

// MARK: - SelectionSet
public protocol SelectionSet: Hashable {
public protocol SelectionSet: Hashable, CustomDebugStringConvertible {
associatedtype Schema: SchemaMetadata

/// A type representing all of the fragments the `SelectionSet` can be converted to.
Expand Down Expand Up @@ -117,6 +117,10 @@ extension SelectionSet {
@inlinable public static func ==(lhs: Self, rhs: Self) -> Bool {
return lhs.__data == rhs.__data
}

public var debugDescription: String {
return "\(self.__data._data as AnyObject)"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this print more than the data inside the DataDict, like the fulfilledFragments etc? And are we good with a readable format like provided by casting to AnyObject like the screenshot or do we want to manually create an output from keys/values?

Screenshot 2024-07-02 at 12 37 25 AM

}
}

extension SelectionSet where Fragments: FragmentContainer {
Expand Down
Loading