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

Crash when using mocks for Double Nested Arrays #2809

Closed
scottasoutherland opened this issue Feb 4, 2023 · 5 comments · Fixed by #2939
Closed

Crash when using mocks for Double Nested Arrays #2809

scottasoutherland opened this issue Feb 4, 2023 · 5 comments · Fixed by #2939
Assignees
Labels
bug Generally incorrect behavior planned-next Slated to be included in the next release

Comments

@scottasoutherland
Copy link

Summary

I have a schema that looks something like this:

type InnerObject { 
    propertyOne: Int!
    propertyTwo: Int!
}

type OuterObject { 
    propertyOne: Int!
    propertyTwo: [[InnerObject!]!]!
}

And I have ran codegen for this and created the mocks. When using the mocks in tests, everything compiles fine. However when i set the value of "propertyTwo" two in mocks, and then convert it to a (non-mock) graphQL object using .from(Mock) and then try to access "propertyTwo" in code, it crashes with the error
fatalError("\(Self.self) expected data for entity.")

Version

1.0.5

Steps to reproduce the behavior

  • Use a schema with a property of type:
[[SomeObject!]!]!
  • Generate mocks / code from it.
  • Initialize an object for the containing type use .from(Mock<>)
  • try to access the property of double nested array type.
  • Notices the crash

Logs

No response

Anything else?

Screenshot 2023-02-03 at 8 35 41 PM

Here's what the call stack looks like.

@scottasoutherland scottasoutherland added bug Generally incorrect behavior needs investigation labels Feb 4, 2023
@calvincestari
Copy link
Member

Thanks for the bug report @scottasoutherland. I can replicate the crash, not sure what's going wrong yet though. I'll get back to you once I've dug into it a bit more.

@scottasoutherland
Copy link
Author

Any updates or plans to address this soon? We are having to disable some of tests in our migration to Apollo 1.0.6 since there doesn't seem to be an easy work-around.

@AnthonyMDev
Copy link
Contributor

This is on our list, but we've got a lot of high priority work on at the moment. I can't make a promise of when we will get to this one. If you are interested in digging into the problem and putting up a PR, we'd love to take a look at it. Otherwise, I will try my best to find some time to look at this by the end of the month!

@AnthonyMDev AnthonyMDev added the planned-next Slated to be included in the next release label Apr 6, 2023
@AnthonyMDev
Copy link
Contributor

I've got a unit test reproducing this now and I'm working on a fix!

@scottasoutherland
Copy link
Author

Great to hear! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Generally incorrect behavior planned-next Slated to be included in the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants