Need help: How do I go about figuring out what causes my GraphQL query to fail when using standalone:master?

I’m not sure how to add a default value a @custom graphql query with embedded DQL?

I actually had this issue before come to think of it—Use GraphQL Vars In regex - #5 by noisykeyboard

I’ve tried various syntaxes, can’t get it to work:

type Metadata @auth(
  query: { rule: "{ $ROLE: { eq: \"ADMIN\" } }" }
  add: { rule: "{ $ROLE: { eq: \"ADMIN\" } }" }
  update: { rule: "{ $ROLE: { eq: \"ADMIN\" } }" }
  delete: { rule: "{ $ROLE: { eq: \"ADMIN\" } }" }
){
  total_count: Int
}
  queryTranscriptsIndexMetadata(keyword: keyword = "//i"): Metadata @custom(dql: """
    query q($keyword: string) {
      var(func: type(Transcript)) @filter(regexp(Transcript.name, $keyword)) {
        a as count(uid)
      }

      queryTranscriptsIndexMetadata() @normalize {
        total_count : sum(val(a))
      }
    }
   """)
  queryTranscriptsIndexMetadata(keyword: String!): Metadata @custom(dql: """
    query q($keyword: string = "//i") {
      var(func: type(Transcript)) @filter(regexp(Transcript.name, $keyword)) {
        a as count(uid)
      }

      queryTranscriptsIndexMetadata() @normalize {
        total_count : sum(val(a))
      }
    }
   """)
  queryTranscriptsIndexMetadata(keyword: String!): Metadata @custom(dql: """
    query q($keyword: keyword = "//i") {
      var(func: type(Transcript)) @filter(regexp(Transcript.name, $keyword)) {
        a as count(uid)
      }

      queryTranscriptsIndexMetadata() @normalize {
        total_count : sum(val(a))
      }
    }
   """)
  queryTranscriptsIndexMetadata(keyword: String!): Metadata @custom(dql: """
    query q($keyword = "//i") {
      var(func: type(Transcript)) @filter(regexp(Transcript.name, $keyword)) {
        a as count(uid)
      }

      queryTranscriptsIndexMetadata() @normalize {
        total_count : sum(val(a))
      }
    }
   """)
  queryTranscriptsIndexMetadata(keyword: String! = "//i"): Metadata @custom(dql: """
    query q($keyword: string = "//i") {
      var(func: type(Transcript)) @filter(regexp(Transcript.name, $keyword)) {
        a as count(uid)
      }

      queryTranscriptsIndexMetadata() @normalize {
        total_count : sum(val(a))
      }
    }
   """)

Would also appreciate some instructions on how to build a Docker image from a specific commit—I’ll go back through the commits until I figure out which one causes the issue.
EDIT: Looks like I can just use GitHub - MichelDiz/dgraph_master: Build Dgraph from master branch (nightly? Dgraph binary - Alpine), and clone/checkout a specific commit before building.

EDIT: This one works in v21.03 (But not on master):

  queryTranscriptsIndexMetadata(keyword: String!): Metadata @custom(dql: """
    query q($keyword: string = "//i") {
      var(func: type(Transcript)) @filter(regexp(Transcript.name, $keyword)) {
        a as count(uid)
      }

      queryTranscriptsIndexMetadata() @normalize {
        total_count : sum(val(a))
      }
    }
   """)
1 Like