graphql / graphql-spec

GraphQL is a query language and execution engine tied to any backend service.
https://spec.graphql.org
14.31k stars 1.12k forks source link

Repository names with dashes cannot be requested #989

Closed arhadthedev closed 2 years ago

arhadthedev commented 2 years ago

I need to get some statistics from a repository which name contains dashes (https://github.com/python/core-workflow):

{
  repository(name: "core-workflow", owner: "python") {
    object(expression: "main") {
      ... on Commit {
        history(author: {emails: "oleg@arhadthedev.net"}) {
          totalCount
        }
      }
    }
  }
}

However, it cannot be requested:

{
  "data": {
    "repository": {
      "object": null
    }
  }
}

Other, dashless repositories from the same organization work great:

{
  repository(name: "cpython", owner: "python") {
    object(expression: "main") {
      ... on Commit {
        history(author: {emails: "oleg@arhadthedev.net"}) {
          totalCount
        }
      }
    }
  }
}
{
  "data": {
    "repository": {
      "object": {
        "history": {
          "totalCount": 39
        }
      }
    }
  }
}

From gh-479 I know that no object key can contain a dash. Nonetheless, repositories with dashes in their names are totally legit so there should be a way to address them in queries.

rivantsov commented 2 years ago

why is this issue posted here? yes, this repo name contains dash, GitHub GraphQL API has problems with it, but what we can do about it? rename the repo?!

arhadthedev commented 2 years ago

but what we can do about it? rename the repo?!

Sure, not. However, denying repositories that are valid for the rest of the whole GitHub makes GraphQL-based tools unusable for such repositories.

Here's an example from Trending Repositories to demonstrate that dashed names is not a feature of some student labs needed by no-one. Dashed repo names are highlighted:

rivantsov commented 2 years ago

sorry, I think you have an impression that people here (around this repo) are actually in charge of Github's GraphQL API? that's not the case; you should connect to Github support team.

arhadthedev commented 2 years ago

sorry, I think you have an impression that people here (around this repo) are actually in charge of Github's GraphQL API

My sincere excuses then. The README's line This is a Working Draft of the Specification for GraphQL gave me an impression that this repo is where GraphQL sponsors define how the world should work; something like https://github.com/w3c for the Web and https://github.com/tc39 for JavaScript aka ECMAScript.

you should connect to Github support team.

It was unintuitive so thank you for the relevant contact.

benjie commented 2 years ago

@arhadthedev By the looks of your query result the repository was found because it’s non-null; the object is null - perhaps it uses an alternative main branch name such as “trunk” or “master”? I hope this helps.

brasic commented 2 years ago

@arhadthedev you want object(expression: "HEAD") to select the default branch, the repo you linked to has no ref called main.

arhadthedev commented 2 years ago

My apologises for misidentifying the problem. The repo is the only one in my list which master branch was not renamed so I didn't notice it and came googling for the error message instead.

@brasic Thank you for a name-agnostic solution.