Graphiti icon indicating copy to clipboard operation
Graphiti copied to clipboard

Duplicate type registration

Open maximkrouk opened this issue 3 years ago • 0 comments

Is there any behaviour that relies on String(describing: type) in

// Sources/Graphiti/Definition/AnyType.swift

final class AnyType : Hashable {
	// ...
    func hash(into hasher: inout Hasher) {
        hasher.combine(String(describing: type))
    }
    // ...
}

It won't allow you to use nested types for your models like ModelA.Response ModelB.Response And you will get an error

Duplicate type registration for GraphQLType "Response" while trying to register type Response

Using String(describing: type) will provide "ModelA.Response" string, .components(separatedBy: ".").joined() can remove the dot if needed. Should I submit a PR to support this stuff?

maximkrouk avatar Feb 10 '22 13:02 maximkrouk