-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(GRAPHQL):[Breaking] Don't generate get query on interface if it doesn't have field of type ID and also disallow get query on field of type @id in inerface. #7158
Conversation
There was a problem hiding this 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 2 files reviewed, 1 unresolved discussion (waiting on @jatindevdg, @MichaelJCompton, and @pawanrawal)
graphql/schema/testdata/schemagen/output/interface-with-id-directive.graphql, line 455 at r1 (raw file):
type Query { getLibraryItem(refID: String!): LibraryItem
Is there also a test where interface has both id: ID!
and a field with @id
directive.
added test |
There was a problem hiding this 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 4 files reviewed, 2 unresolved discussions (waiting on @jatindevdg, @MichaelJCompton, and @pawanrawal)
graphql/schema/gqlschema.go, line 1735 at r2 (raw file):
if (!hasIDField && defn.Kind == "INTERFACE") || (!hasIDField && !hasXIDField)
can be simplified to:
if !hasIDField && (defn.Kind == "INTERFACE" || !hasXIDField)
…oesn't have field of type ID and also disallow get query on field of type @id in inerface. (#7158) Fixes GRAPHQL-886 We were allowing get query on the field of type @id on the interface type. This causes an error in cases when interface is implemented by multiple types and they try to have same value for field of type @id. To resolve this we are disallowing get query on the interface if it doesn't have a field of type ID , and if we have both fields of type ID and @id then we don't allow get query on the field of type @id. (cherry picked from commit 96b1fa5)
…oesn't have field of type ID and also disallow get query on field of type @id in inerface. (#7158) (#7305) Fixes GRAPHQL-886 We were allowing get query on the field of type @id on the interface type. This causes an error in cases when interface is implemented by multiple types and they try to have same value for field of type @id. To resolve this we are disallowing get query on the interface if it doesn't have a field of type ID , and if we have both fields of type ID and @id then we don't allow get query on the field of type @id. (cherry picked from commit 96b1fa5)
Fixes GRAPHQL-1119 We had this bug fix PR #7158 that also went into 20.11 release branch which disallow id argument in get queries on interfaces. Because it was breaking change , we are now rolling back this change and mark it as deprecated, and change later. Orignal bug https://discuss.dgraph.io/t/id-directive-and-interfaces/11642 Workaround So, we have disallowed @id argument from get query on interface, but the normal query still have it. So, users can change their get queries with simple query as follows. Interface with @id field interface Foo { id: String! @id } We can change below query query{ getFoo(id:"test"){ id } } to query{ queryFoo(filter: {id:{eq: "test"}}){ id } } Related Posts https://discuss.dgraph.io/t/id-directive-and-interfaces/11642 https://discuss.dgraph.io/t/was-there-a-change-to-generated-queries-with-id-directives-in-v20-11-1/12591
Fixes GRAPHQL-1119 We had this bug fix PR #7158 that also went into 20.11 release branch which disallow id argument in get queries on interfaces. Because it was breaking change , we are now rolling back this change and mark it as deprecated, and change later. Orignal bug https://discuss.dgraph.io/t/id-directive-and-interfaces/11642 Workaround So, we have disallowed @id argument from get query on interface, but the normal query still have it. So, users can change their get queries with simple query as follows. Interface with @id field interface Foo { id: String! @id } We can change below query query{ getFoo(id:"test"){ id } } to query{ queryFoo(filter: {id:{eq: "test"}}){ id } } Related Posts https://discuss.dgraph.io/t/id-directive-and-interfaces/11642 https://discuss.dgraph.io/t/was-there-a-change-to-generated-queries-with-id-directives-in-v20-11-1/12591
Fixes GRAPHQL-886
We were allowing get query on the field of type
@id
on the interface type. This causes an error in cases wheninterface
is implemented by multiple types and they try to have same value for field of type@id
.To resolve this we are disallowing get query on the interface if it doesn't have a field of type
ID
, and if we have both fields of typeID
and@id
then we don't allow get query on the field of type@id
.This change is