-
Notifications
You must be signed in to change notification settings - Fork 251
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
GraphQL helper doesn't support query and mutation on the many-to-many connection models #1814
Comments
Hi @MarlonJD thank you for posting your issue and providing a detailed explanation of what you did. It appears you are trying to access the Department field on your Student object. We do not load the fields (except id) for nested models. The Student object has a Department field. The Department field is a nested model so we do not load all fields of that object. In the error message you received:
Instead, you can use the Department object's id field to make another query for the full Department object. Apologies this wasn't clear in the beginning. We'll look internally into how we might improve documentation regarding this behavior. |
Yes i understand what you mean but this isn't the solution because there is no department id in response. That's the issue. We can add access nested object if it's first level on Amplify.API, so there is no nested object issue in here. İssue is in the graphql document that using for the query. İf there was departmentID it could be. And student already becoming readable and also nested. So i don't think it is nested object issue. |
Thanks for the clarification @MarlonJD we'll take a further look. The issue appears to be with nested model behavior and how to query for relationships of |
Hello @MarlonJD Thanks for reporting this issue and providing the details.
I did some testing, I can see the API GraphQL helper currently supporting only generating GraphQL document with 1
As GraphQL helper rolled out prior to Amplify GraphQL Transformer v2, it looks like we have a function disparity now. I will mark this issue as a feature request to follow up. As a workaround, please continually create GraphQL document manually. Sorry for the inconvenience. Also -
Sorry that you encounter issues with DataStore, would you mind to share them with us, and to see how can we help? (I searched but seems that you haven't reported any issues around DataStore yet) |
Hey thanks for you detailed answer. First of all, we need to fix graphql request creation or something like fullRequest: true parameter and make query with all fields included nested models. |
Thanks for the follow up @MarlonJD I'll find some time to test the datastore issue you described. |
hey @HuiSF is that really true? I have a relationship that I believe has two @belongsto relationships yet I am able to save both succesfully: |
Hi @RikiZimbakov can you please share the graphql schema you're using? |
Thank you for all detailed answer. Same scheme and i just cannot sync datastore. İt's giving me error, when anything has 2 belongsTo even it's manyToMany. I tried to modify add all belongsTo but Json is malformed before there. Maybe i have to modify android/iOS library instead of flutter. I'll try to dig in again |
@fjnoyp - Feel free to check out issue #2073 for a simple schema to replicate the issue. @haverchuck was kind enough to link my ticket to this issue. As this has been a showstopper for my team and client, we dug further into the issue. I've found that inside of the graphql_request_factory.dart, when the request gets inside of
As you can see, it calls
What I'm not sure of, is how the fields are being selected for removal, since the entry.value.association SHOULD be This is where I believe the fields are being removed causing the issue related to this ticket. From what I can see, it doesn't appear multiple belongsTo on a single model was ever implemented. Hopefully this information helps the team drive towards a hastened delivery of the solution. If this is duplicative information that the team was already aware of...don't mind me and Carry On! :) |
Hi @ignitum-ryan thanks for your great insights here! Yes the |
Description
Hello everyone. After encountering a lot of problems about DataStore, I removed all DataStore and check realtime datas on AppSync from Amplify on Flutter. Anyways here's is the issue.
TL; DR: ModelQueries.list creating missing document
related schema:
That's my query, it should work here's is request:
here's the response, error related to department is null:
Let's investigate graphql document and variables:
document:
As we can we, there's no department in the graphql document, that's the issue. ModelQueries.list should create department as I need.
So I tried to modify variable and create custom request like this. I didn't use original document to modify because on filter there is filter object and I didn't want to parse these:
and here's the variable and document:
and response:
So it's succeed.
Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Android Device/Emulator API Level
API 21
Environment
Dependencies
Device
iPod Touch 7
OS
iOS 15.5
CLI Version
9.0.0
Additional Context
No response
The text was updated successfully, but these errors were encountered: