GraphQL aliases not possible due to dgraph internal graphql+-

Would something like this work for you?

  • Schema
type Text {
  text: String! @search(by: [trigram, term, fulltext])
  lang: String! @search(by: [hash])
}

type Film {
  id: String! @id
  name: [Text!]
}
  • mutation
mutation {
  addFilm(input: [{id: "avengersendgame", name: [{
    text: "Avengers Endgame",
    lang: "en-US",
  },{
    text: "Avengers Endugamu",
    lang: "ja-JP",
  }]}]) {
    film {
      id
      name {
        text 
        lang
      }
    }
  }
}
  • Query for the movie in en-US
query {
  queryFilm(filter: {id: {eq: "avengersendgame"}}) {
    name(filter: {lang: {eq: "en-US"}}) {
      text
      lang
    }
  }
}
  • Query for the movie in en-US or ja-JP
query {
  queryFilm(filter: {id: {eq: "avengersendgame"}}) {
    name(filter: {lang: {eq: "en-US"}, or: {lang: {eq: "ja-JP"}}}) {
      text
      lang
    }
  }
}

We also have support for lang tags in GraphQL±, support for that hasn’t been added to GraphQL yet. If we had that, then there might be better ways of doing this for you.

Dgraph query failed because Dgraph execution failed because : while converting to subgraph: names not allowed multiple times in same sub-query.

This looks like a bug and we are going to work on fixing it. You should be able to query the same field by using different aliases. GraphQL± allows that and so should GraphQL.