Report a GraphQL Bug
What edition and version of Dgraph are you using?
Edition:
- SlashGraphQL
- Dgraph (community edition/Dgraph Cloud)
If you are using the community edition or enterprise edition of Dgraph, please list the version:
Dgraph/Dgraph
Dgraph Version
$ dgraph version
Latest dgraph/dgraph Image (v23.0.1) running via Docker Container.
Have you tried reproducing the issue with the latest release?
Tried on latest version and on dgraph/standalone Docker image @v20.0.3 (I think that’s the version standalone runs on).
Steps to reproduce the issue (paste the query/schema if possible)
...
type User {
id: ID
email: String! @id @search(by: [hash])
username: String @id @search(by: [hash])
...
}
...
Expected behaviour and actual result.
curl -X POST localhost:8080/admin/schema --data-binary '@./dgraph/schema.graphql'
When running the above curl command to initialize my schema in the db, it should simply return a success message but it returns the below message:
{"errors":[{"message":"resolving updateGQLSchema failed because input:47: Type User; Field username: with @id
directive must be of type String!, Int! or Int64!, not String\n (Locations: [{Line: 3, Column: 4}])","extensions":{"code":"Error"}}]}
If I make the username a non-nullable field, it works, but I thought having a nullable @id field was possible in dgraph version >= 21.07 after reading these posts: Nullable @id field & RFC: Mutable and null able @id field in GraphQL. Am I misunderstanding something here? It seems that I can’t get it to work in my dev environment. Is there something I’m missing in my implementation?
Any help would be greatly appreciated
PS - Sorry if this is the wrong topic to place this, wasn’t sure.