-
Notifications
You must be signed in to change notification settings - Fork 730
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
Conflicting field names on input object #3257
Comments
Hi @alexifrim - you could use a GraphQL field alias to rename the field and the generated model would take on the alias name instead. |
In additional to field aliases, we are also planning a future feature that will allow you to alter the generated names of schema types. So that might help solve this issue from the other end. Not that we are necessarily against adding this I feel like it's a very broad approach, as with |
A field alias won't work, as the issue is when generating the schema types - more specifically, this ends up as an issue inside the
But yes, an option to alter the generated name of schema type (as long as it's also possible to distinguish between relationships and fields), should also work as long as it's isolated cases that cause the conflicts. I think that it's great to have a layer that can change the generated field names, but in my opinion, at least for the casing, there should be an option to allow generating names as they are. |
So, it looks to me like this is about the names of the fields on your input object, rather than the names of the actual types. Please clarify if I'm wrong on that. It looks to me like the issue here is that your schema has an input object that looks something like this: input Something_bool_exp {
Book: Books_bool_exp
book: String_comparison_exp
} This isn't about the names of the types ( |
Yes - that is correct, sorry for the misunderstanding, I thought they're related |
Thanks for the confirmation. We'll have to consider how best to address this issue. This is an edge case we hadn't yet had reported, so thanks for bringing it to our attention. I don't think there is really a workaround for you in the mean time. So this is something we need to address. |
We're going to add a conversion strategy that mimics the enum case conversion strategy to account for this edge case. |
Use case
At the moment, if for some reason there's a field named
book
and a relationship namedBook
(I know, bad, but we can't always control the schema), we end up with a conflict (redeclaration).I think there should be an option (e.g.
none
) such that the field names are kept as they are (except for special swift keywords). Changing the case can easily lead to conflicts in plenty of situations.Describe the solution you'd like
A new enum case (
none
) should be added toFieldAccessors
, while this line would go under case .idiomatichttps://github.com/apollographql/apollo-ios/pull/3171/files#diff-43df1d4b245bbf664b141527621ce12de522a1fa92789bd87d4f39d8f5ef6865R52
The text was updated successfully, but these errors were encountered: