20.11.1 breaks our project with custom ID types

Unfortunately, 20.11.1 breaks our software.

  • [BREAKING] Fix(GRAPHQL): 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) (#7305)

We use uuids for every object, also for interfaces.

interface Foo {
 id: String! @id
}

And we rely on setting these IDs from the client due to synchronization mechanics. This is not possible with id: ID!

Can you please re-enable the query generation when @id type only exists on the interface? Or tell us how we should move forward?

@JatinDevDG On github, your reasoning was:

[…] in cases when interface is implemented by multiple types […]

But this is always the case with interfaces. Otherwise you wouldn’t have to use interfaces in the first place.

In my opinion, instead of disallowing the query generation, you should rather make sure that all implementing types have unique ids when they are added and return an error to the client.

On another note, it would be good if you communicate such breaking changes in advance such that people can react to it and give feedback.

Edit:
For a workaround I guess I could just use both ID and @id. And for the get query I’ll have to use ID. This is not ideal, but I think it works.

1 Like

Hi @maaft , sorry for this change. This should have been communicated in advance. We will take care of it in the future as mentioned in a related post.
Was there a change to generated queries with @id directives in v20.11.1

So, we are not generating get query for the interface if it doesn’t have an ID type but we are still generating Filter Query for it. If possible can you please change get queries on interfaces that uses @id directive to filter queries as mentioned in attached post.

query{
queryFoo(filter: {id:{eq: "dgraph"}}){ 
        id
   } 
}

I hope this will help you to move forward.Thanks.

1 Like

Thank you very much. That will work!

1 Like

We have added support in master branch for @id fields in interface that are unique across all the implementing types.
PR:https://github.com/dgraph-io/dgraph/pull/7710

1 Like