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

Fix: Wrapped Aliased Type Resolution #90

Conversation

NeedleInAJayStack
Copy link
Member

This fixes #41

This added a collection of all SwiftTypes and their aliased GraphQL names to TypeProvider. These names are collected before any GraphQL types are created, and are used when resolving TypeReferences, so out-of-order references to aliased types are no longer mis-addressed.

To do so, we had to add a setGraphQLName function to the Component class, and implementations for all GraphQL Type components (Enum, Input, Interface, Scalar, Schema, Type, and Union). Schema construction now goes through all components to collect names prior to building up the GraphQL schema objects.

Specifically, an out-of-order declaration that causes a type reference naming issue
The TypeProvider contains an additional collection of all SwiftTypes and their aliased GraphQL name. These names are used when resolving TypeReferences, so out-of-order references with an alias are no longer mis-addressed.
@NeedleInAJayStack NeedleInAJayStack force-pushed the fix/wrapped-aliased-type-resolution branch from 38e4b3f to 1484360 Compare January 8, 2023 23:59
@NeedleInAJayStack NeedleInAJayStack removed the request for review from paulofaria January 9, 2023 00:08
@NeedleInAJayStack
Copy link
Member Author

Hey @paulofaria, you mind giving this one a quick review?

Copy link
Member

@paulofaria paulofaria left a comment

Choose a reason for hiding this comment

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

LGTM!

@paulofaria
Copy link
Member

Got this error message when trying to merge.

image

@NeedleInAJayStack NeedleInAJayStack merged commit b2ebace into GraphQLSwift:main Jan 17, 2023
@NeedleInAJayStack
Copy link
Member Author

@paulofaria Woah, weird. It let me merge it fine...

@NeedleInAJayStack NeedleInAJayStack deleted the fix/wrapped-aliased-type-resolution branch January 17, 2023 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If a type's name is overridden, then TypeReference behaves oddly.
2 participants