I tried using that already and it appears that is also not working. I have tried multiple attempt . Including dropping entire schema and recreating it.
I would have hoped that either of two service usage would have a unified experience as since they are both essentially resulting the same under the hood.
They do. I use daily DQL & GQL to manage the same dataset. There is probably a small misunderstanding somewhere with how your schema translates to DQL from GQL. Do you use Interfaces? That throws another kink into the mix.
type User {
username: String! @id
isContact: Contact! @hasInverse(field: isUser)
hasSettings: [UserSetting]
isActive: Boolean
}
type Contact {
id: ID!
name: String!
hasSettings: [ContactSetting]
isUser: User
}
interface Setting {
id:
name: String!
type: SettingType
value: String!
}
type ContactSetting implements Setting {
forContact: Contact! @hasInverse(field: hasSettings)
}
type UserSetting implements Setting {
forUser: User! @hasInverse(field: hasSettings)
}
enum SettingType {
BOOLEAN
STRING
FLOAT
INT
}
And make the following mutation:
mutation MyMutation {
addUser(input: [
{
username: "amaster"
isActive: true
isContact: {
name: "Anthony Master"
hasSettings: [
{
name: "isAwesome"
type: BOOLEAN
value: "true"
}
{
name: "favoriteColor"
type: STRING
value: "Blue"
}
]
}
hasSettings: [{
name: "netWorth"
type: FLOAT
value: "0.02"
}]
}
]) {
numUids
user {
username
hasSettings {
id
name
type
value
}
isContact {
id
name
hasSettings {
id
name
type
value
}
}
}
}
}
Your would write the correlating DQL (GraphQL±) query as:
query {
# The `Users` in the next line, could be most anything. We could even name it Contacts and it would still get the Users as that is the function.
Users(func: type(User)) { # This could be uid(), eq(), or any other supported function
uid # Still has a uid even though username used as xid with @id directive in graphql schema
User.username
User.isContact {
uid # There is no Contact.id but rather it gets translated to uid under the hood by the graphql endpoint. This is true for any ID usage in the schema
Contact.name
Contact.hasSettings {
uid
ContactSetting.forContact { # fields from the implementation are dotted with the implementation type
uid # This is redundant data, just wanted to show the implementation dotted notation above
}
Setting.name # fields from the interface keep the interface's dotted notation
Setting.type
Setting.value
}
}
User.isActive
User.hasSettings {
uid
UserSetting.forUser {
uid
}
Setting.name # See comments above why this is Setting.name and not UserSetting.name
Setting.type
Setting.value
}
}
}