-
Notifications
You must be signed in to change notification settings - Fork 199
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
Are many-to-many connections supported? #254
Comments
Providing a bit more information on this ticket, I checked the documentation trying to understand why this is an issue. In this particular scenario I have modelled the |
Right now the only way to achieve many-to-many is like you did, define a model so you connect two other models via one-to-many. Automatic (or implicit) many-to-many mapping is something that we intend to support in the future but no concrete plans as of now. Regarding the error you're seeing, can you share the code you're using to execute the mutation? |
If you are talking about the swift code to execute the mutation, here it is: let person: Person // This was fetched from the api.
let country: Country // this was also fetched from the api.
let nationality = Nationality()
nationality.person = person
nationality.country = country
Amplify.API.mutate(of: nationality, type: .create) { event in
switch event {
case .completed(let result):
print(String(describing: result))
case .failed(let error):
print("Why it does NOT WORK?")
print(String(describing: error))
print(String(describing: event))
default:
print("Ignoring this scenario for now.")
}
} Both the instance of persona and country where created just before inserting the nationality, chained as part of the callback for each of its mutate methods. As I mentioned before, this definition is using the |
@rodrigoelp Is this still an issue with the latest released version of Amplify? |
Hi @palpatim, I haven't checked to be honest. We moved away from amplify and now I don't have access to an environment I could use to test this. |
Thanks for the update. We've successfully tested many-many connections in the GA version of Amplify and haven't seen issues like you described, so I'm closing this issue. |
I have been unable to create a many-to-many relationship with the current api.
I started with the following model:
The model generation will create an instance:
Which seems perfectly fine until you call the mutation and get the following error:
Trying out the endpoint directly in console/AppSync/Query I can see the mutation requires me to provide more than just the ids, it requires the the instances of person and country as well and it seems the generated code isn't doing it for me.
Is this a bug of the generator, a more fundamental issue or am I doing something wrong here?
The text was updated successfully, but these errors were encountered: