-
Notifications
You must be signed in to change notification settings - Fork 217
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
Multi-directional relationships will cause the runtime to fail when building the schema #906
Comments
I'm currently having a look at this (managed to write a unit test that can validate schemas in a much simpler way). The problem is that when it is trying to create the Now this is only a problem on the |
Actually, it does raise an interesting question, how do we handle relationships within a mutation? The problem exists because it's trying to create an input type that allows you to insert a multiple entities in a single pass, so you could do this: mutation {
createBook(input: { id: "...", title: "...", Authors: [{ id: "...", first_name: "...", last_name: "...", middle_name: "...", Books: [{ id: "...", title: "..." }] }]) {
id
}
} Is this expected? Should we be allowing you to create recursive items such as this? I don't think you should be able to.
|
After doing some more digging, I've found that this bug is caused by a change introduced with #531 It doesn't impact the SQL engine, as it's only allowing nested models on Cosmos. Looking at the tests that were included, they only tackle one-way relationships, not two-way, which is likely why it was never picked up then. |
Needs an RFC to specify what the behavior for nested mutations should be for both Cosmos and SQL - @sajeetharan, @yorek |
i am also running into this: consider the following graphql schema: type IndustryModel @model {
id: ID
type: String
name: String
description: String
collections: [Collection]
}
type Collection {
id: String
name: String!
description: String
children: [Collection]
} this will also cause the stack overflow
maybe being able to specify a max depth for a recursive relationship might prevent this? |
PR #2192 adds protection against circular references and throws an exception. This will prevent engine crashing rather throw helpful error messages to the user. |
Currently the engine throws an error with the getting started sample
Here is the query to get list of books and authors:
and the schema as follows,
it throws an error as The runtime refused to evaluate expression at this time
The text was updated successfully, but these errors were encountered: