Using reserved keyword Type
as in selection fields does not compile
#3006
Labels
bug
Generally incorrect behavior
codegen
Issues related to or arising from code generation
planned-next
Slated to be included in the next release
Milestone
Summary
Using reserved keywords for fields in a type results in the failure to compile the project. I have a type called
QueueDto
which has several fields, one of which is calledType
. When using version 1.0.5 theType
will be generated asGraphQLEnum<Type>
which is fine, however, when using any version higher than 1.0.5 (even the latest, 1.1.3), it will append it with the namespace (in my caseMainApi
). It will try to useGraphQLEnum<MainType.Type>
, where.Type
is probably some reserved Swift keyword or property. Is there any way to get around this problem, I would not like to rename the field at the server-side, is there any way to transform it for code generation or any other possible option I could try?Part of the generated query with version 1.0.5
Part of the generated query with version 1.1.3
Version
1.1.3
Steps to reproduce the behavior
In order to reproduce, you need to have a schema which has a type that has a field called
type
. When generating the code, a swift file will be generated (in this case GetQueueQuery.graphql.swift) which will contain a reference toYourNamespace.Type
. I have attached all possible files I could think of to reproduce, please let me know if there is something missing.Schema.graphqls file
GetQueue.graphql
apollo-codegen-config-main.json
Logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: