Generated test Mock code produces compilation error when object contains property named "hash" #2950
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
Bug report
Currently, there's a compilation error in generated mock code when the object contains a property named "hash". The compiler throws an error inside the convenience initializer of the mock object, when it tries to assign a value to the "hash" property.
This is the the error message:
'let' property 'hash' may not be initialized directly; use "self.init(...)" or "self = ..." instead
Versions
apollo-ios
SDK version: 1.1.1apollo-ios-cli
version: 1.1.1Steps to reproduce
apollo-ios-cli
using a schema with a response object that has a property namedhash
.Further details
Here's the generated code (all other properties have been redacted) that it generates to mock a response object of an operation:
Manually editing and renaming this property to anything -- say,
_hash
-- already solves the problem. But this is obviously not a solution as the file will be overwritten every time you run the code generation script.Version
1.1.1
Steps to reproduce the behavior
apollo-ios-cli
using a schema with a response object that has a property namedhash
Logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: