Subscript GraphQL variable from dictionary crash when Swift modifier used as key. #2759
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
Hey there, great thanks for hard work put into new release!
Recently I've started to migrate from 0.53 to 1.0.5 and have to say - it's not a very easy task to achieve. Now I've stomped on issue that nobody else mentioned before (based on my research).
Everything was working fine before the migration - I think it's issue related to the codegen feature.
When I got in schema variable in fragment named after Swift's special words
default
,public
,private
or else then in generated code it's__data["'public'"] }
(apostrophes on each side to escape the special word)It leads to a problem in getting the value resulting a crash as in subscript.
part of generated file:
Maybe we should stripe the apostrophes which are clearly from the Swift requirements not from a schema.
Version
1.0.5
Steps to reproduce the behavior
public: Bool
.Logs
Anything else?
As a workaround I've applied direct dictionary lookup for
public
field as follows:let lhsPublic: GraphQLNullable<Bool> = lhs.__data["public"]
The text was updated successfully, but these errors were encountered: