Schema not defined for predicate

Hey,
I’m a beginner in fields of GraphQL and also Dgraph, so I faced the following error.
Is this a bug or am I doing something completely wrong?

For clarification: I wanted to move the fields outside the type, so I can generate dropdowns from distinct field values.

Error I get after my request

Error: mutation addWorker failed because Dgraph execution failed because : Got error: Schema not defined for predicate: WorkerField.value. while running: name:"eq" args:"2" 

My Schema

# Dgraph.Allow-Origin "*" 

enum WorkerFieldType {
  TL_SECTION
  SEGMENT
  WORK_AREA
}

type Worker {
  id: ID!
  name: String! @id
  tlSection: WorkerField!
  segment: WorkerField!
  workArea: WorkerField!
  process: WorkProcess
}

type WorkerField {
  id: ID!
  value: String! @id
  fieldType: WorkerFieldType!
}

type WorkProcess {
  id: ID!
  name: String
  workers: [Worker] @hasInverse(field: "process")
}

My Query

mutation AddWorker($data: AddWorkerInput!) {
    addWorker(input: [$data]) {
        worker {
            id
        }
    }
}

My variables

{
   "data":{
      "name":"asdf",
      "tlSection":{
         "value":"2",
         "fieldType":"TL_SECTION"
      },
      "segment":{
         "value":"1",
         "fieldType":"SEGMENT"
      },
      "workArea":{
         "value":"3",
         "fieldType":"WORK_AREA"
      }
   }
}

Is there an original schema you migrated from?

1 Like

Oh dang, I thought I had wiped the docker container…
Turns out I didn’t. Removing the volume actually fixed my problem ^^
Thank you very much for helping me out :slight_smile: