spinelsun
(Or Chen)
November 5, 2020, 11:06am
1
Hi,
I have this mutation:
mutation MyMutation {
addBranch(input:
[
{
orkId: "0x13882-master",
changeMark: "76c0e168329e4a938344816f02e09d45",
name: "master",
versions:
[
{
code: "1.0",
createdAt: "2020-11-05",
createdBy: {username: "orch"},
vid: "76c0e168329e4a938344816f02e09d46",
orkId: "0x13882-master-1.0",
wayOfCreation: Root
},
{
code: "1.1",
createdAt: "2020-11-05",
createdBy: {username: "orch"},
vid: "76c0e168329e4a938344816f02e09d47",
orkId: "0x13882-master-1.1",
wayOfCreation: New_Version
}
],
in: {id: "0x13882"},
createdAt: "2020-11-05",
createdBy: {username: "orch"}
}
]
) {
branch {
orkId
changeMark
createdAt
createdBy {
username
}
in {
id
}
versions {
orkId
vid
wayOfCreation
createdAt
code
createdBy {
username
}
}
name
}
}
}
I get this error message
“mutation addBranch failed because Dgraph execution failed because Some variables are used but not defined\nDefined:[Version11 Version7 __dgraph__0 __dgraph__1]\nUsed:[User4 Version11 Version7 __dgraph__0 __dgraph__1]\n”
It is strange because I use all fieldsi defind in the input
What Am I missing?
Thanks,
Spinelsun
1 Like
Anurag
(Anurag)
November 5, 2020, 11:20am
2
spinelsun:
wayOfCreation: Root
Shouldn’t this be "Root"
?
pawan
(Pawan Rawal)
November 5, 2020, 2:26pm
4
Can you share your schema for the nodes that you are mutating so that we can reproduce this locally and do a potential fix?
maaft
November 5, 2020, 2:29pm
5
Possibly related (example schema included):
Yes, sure. Sorry, I couldn’t come up with a shorter example.
I’m using latest master from yesterday (~20 hours ago)
Schema:
type User {
username: String! @id
password: String!
projects: [Project!] @hasInverse(field: owner)
}
type Project {
id: String! @id
owner: User!
name: String! @search(by: [hash])
datasets: [Dataset!] @hasInverse(field: project)
}
type Dataset {
id: String! @id
owner: User!
project: Project!
name: String! @search(by: [hash])
}
Create User…
spinelsun
(Or Chen)
November 5, 2020, 2:46pm
6
type User {
username: String! @search(by: [hash, regexp]) @id
name: String
email: String! @search(by: [hash, regexp])
memberships: [Membership!] @hasInverse(field: belongsTo)
hasCredentials: [Credentials!] @hasInverse(field: forUser)
visits: [UserVisit!]
joinedAt: DateTime @search(by: [month])
}
type Version {
orkId: String! @search(by: [hash]) @id
code: String! @search(by: [regexp, hash])
vid: String!
gitCommit: String @search(by: [hash])
next: Version
previous: Version @hasInverse(field: next)
ofBranch: Branch! @hasInverse(field: versions)
publishedFrom: Version @hasInverse(field: publications)
publications: [Version!]
checkouts: [Branch!]
artifacts: [IArtifact!] @hasInverse(field: inVersion)
createdAt: DateTime!
lastModified: DateTime
createdBy: User!
wayOfCreation: CreationType!
}
type Branch {
orkId: String! @search(by: [hash]) @id
changeMark: String!
name: String! @search(by: [exact, regexp])
versions: [Version!]!
checkedOutFrom: Version @hasInverse(field: checkouts)
in: Repository! @hasInverse(field: branches)
createdAt: DateTime!
createdBy: User!
}
enum CreationType {
New_Version
New_Branch
Publish
Root
}
rajas
(Rajas Vanjape)
November 5, 2020, 8:03pm
7
1 Like