Skip to content

Fix(GraphQL): Ignore redundant references to inverse object in mutation rewriting#7469

Merged
vmrajas merged 1 commit intomasterfrom
GRAPHQL-1046
Feb 23, 2021
Merged

Fix(GraphQL): Ignore redundant references to inverse object in mutation rewriting#7469
vmrajas merged 1 commit intomasterfrom
GRAPHQL-1046

Conversation

@vmrajas
Copy link
Copy Markdown
Contributor

@vmrajas vmrajas commented Feb 23, 2021

After the refactoring of mutation rewriting, references to inverse objects were not ignored in existenceQueries function. This PR fixes this.

This PR fixes https://discuss.dgraph.io/t/bug-not-sure-how-to-name-this-bug-please-help-out/12845
Testing:

  1. Basic yaml tests

This change is Reviewable

@github-actions github-actions Bot added the area/graphql Issues related to GraphQL support on Dgraph. label Feb 23, 2021
Copy link
Copy Markdown
Contributor

@JatinDev543 JatinDev543 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @abhimanyusinghgaur, @pawanrawal, and @vmrajas)


graphql/resolve/add_mutation_test.yaml, line 4170 at r1 (raw file):

            "dgraph.type":["Foo"],
            "uid":"_:Foo3"
        }

can you please add test(if not already present) where we have nested fields but they are not inverse.
For example with below schema
type Foo {
id: String! @id
bar: Bar!
}
type Bar {
id: String! @id
foo: Foo!
}

mutation addBar($input: [AddBarInput!]!) {
  addBar(input: $input) {
    bar {
      id
      foo {
        id
        bar{
          id
        
        }  
      }
    }
  }
}

Copy link
Copy Markdown
Contributor

@JatinDev543 JatinDev543 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @pawanrawal and @vmrajas)

Copy link
Copy Markdown
Contributor Author

@vmrajas vmrajas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jatindevdg and @pawanrawal)


graphql/resolve/add_mutation_test.yaml, line 4170 at r1 (raw file):

Previously, JatinDevDG (Jatin Dev) wrote…

can you please add test(if not already present) where we have nested fields but they are not inverse.
For example with below schema
type Foo {
id: String! @id
bar: Bar!
}
type Bar {
id: String! @id
foo: Foo!
}

mutation addBar($input: [AddBarInput!]!) {
  addBar(input: $input) {
    bar {
      id
      foo {
        id
        bar{
          id
        
        }  
      }
    }
  }
}

There exists such a test in add_mutation_test.yaml by the name, "Deep mutation three level xid with no initial XID" .

It adds Post1 ->linking it to -> Comment1 -> linking it to another Comment1 as reply .There are no inverses.

@vmrajas vmrajas merged commit c66e869 into master Feb 23, 2021
@vmrajas vmrajas deleted the GRAPHQL-1046 branch February 23, 2021 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/graphql Issues related to GraphQL support on Dgraph.

Development

Successfully merging this pull request may close these issues.

3 participants