Skip to content
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

When using the test mock, touching a GraphQLEnum property will cause a crash #2582

Closed
asapo opened this issue Oct 13, 2022 · 3 comments · Fixed by #2584
Closed

When using the test mock, touching a GraphQLEnum property will cause a crash #2582

asapo opened this issue Oct 13, 2022 · 3 comments · Fixed by #2584
Assignees

Comments

@asapo
Copy link

asapo commented Oct 13, 2022

Bug report

Like this:

let mock = Mock<Dog>(type: GraphQLEnum.case(.strong))
let dog = DogFragment.from(mock)

// Crash here:
// Could not cast value of type 'Swift.AnyHashable' to 'ApolloAPI.GraphQLEnum<MySchemaModule.MyEnum>'
dog.type

(Actually, crash at this line)

get { _data[key] as! T }

Versions

Please fill in the versions you're currently using:

  • apollo-ios SDK version: 1.0.1
  • Xcode version: 14.0.1
  • Swift version: 5.7
  • Package manager: 5.7

Steps to reproduce

  • Generate a model that has an enum property.
  • Generate test mocks.
  • Initialize a model by using Model.from(Mock()) method.
  • Touch an enum property.
@AnthonyMDev
Copy link
Contributor

Thanks for the report! We will look into this and have a fix out ASAP.

@AnthonyMDev
Copy link
Contributor

PR to fix this is up. Anticipating cutting a release with this included by end of week.

@asapo
Copy link
Author

asapo commented Oct 16, 2022

Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants