-
Notifications
You must be signed in to change notification settings - Fork 731
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 unqualified scalar collision #2757
Conversation
✅ Deploy Preview for apollo-ios-docs canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - thanks. Just one question about the path for test mock rendering.
replacingNamedTypeWith newTypeName: String? = nil, | ||
config: ApolloCodegenConfiguration | ||
) -> String { | ||
lazy var typeName = { newTypeName ?? self.swiftName.firstUppercased }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to change, my question is more out of curiosity.
Is there a benefit to typeName
and schemaModuleName
being defined as lazy
? The return references both of them; it doesn't look like there is a logic path where they wouldn't be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there isn't anymore. In the old implementation, there we're paths that did not call them. So this is just a carryover from that. We can change these to let
|
||
default: | ||
switch context { | ||
case .testMockField, .inputValue: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renderedAsTestMockField
doesn't look like it flows through this new logic - should it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test mock one works as intended and I just decided not to mess with it to get this PR out. Next time there is a reason to make changes to that rendering, we may want to consider using this function, but I didn't want to break something else that was working at the moment.
@@ -0,0 +1,11 @@ | |||
# Overview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 - we'll get the test infrastructure written up to keep us honest on these, glad we've got this context and won't be losing anything. Nice work!
Fixes #2691
Always qualify names of shared schema types referenced as the types of fields in selections sets. This prevents collisions with names of other generated selection sets for entity type fields whose names are the same as a referenced schema type.
This namespaces enums, custom scalars, and input objects.