Disable nesting cascade in 20.11

Continuing the discussion from Cascade - Graphql:

The master branch (20.11) of this doc states:

In the example below, name is supplied in the fields argument. For an author to be in the query response, it must have a name, and if it has a country subfield, then that subfield must also have name.

{
    queryAuthor  @cascade(fields:["name"]) {
        reputation
        name
        country{
           Id
           name
        }
    }
}

The cascading nature of field selection is overwritten by a nested @cascade .

So how would I form the query where I want the author to have the required name field, but do not require country to have any fields. Is something like this available?

{
    queryAuthor  @cascade(fields:["name"]) {
        reputation
        name
        country @cascade(_none_){
           Id
           name
        }
    }
}

Or maybe with @cascade(fields: []) ?

No, it’s not possible as of now. It’s how we implemented it in Dgraph. But I do think this behavior should be charged as you mention there should be a way to disable @cascade.

We will discuss it internally and get back to you. As of now if your schema permits you can provide some field at the second level which surely will be there. For example Id.

1 Like

Hi @JatinDevDG I’ve just found this PR which is related to this requested feature. So it seems to have been merged before. Isn’t this feature in Dgraph?

That PR adds parameterized cascade in GraphQL on the top of what was already present in Dgraph.
But currently we don’t have any way to disable the @cascade as requested in this post.

Ohh I see, I thought that was the same, my bad.