yanyongyu / githubkit

The modern, all-batteries-included GitHub SDK for Python, including rest api, graphql, webhooks, like octokit!
https://yanyongyu.github.io/githubkit/
MIT License
204 stars 25 forks source link

[GraphQL] error type missing when syntax error #159

Closed roma-glushko closed 2 weeks ago

roma-glushko commented 2 weeks ago

When there is a syntax error like this one:

Response(200 OK, data_model=<class 'githubkit.graphql.models.GraphQLResponse'>)
data=None errors=[GraphQLError(type=None, message='Expected NAME, actual: COLON (":") at [3, 64]', locations=[SourceLocation(line=3, column=64)], path=None, extensions=None)] extensions=None
[]

The GraphQLResponse schema fails to parse it with the following error:

1 validation error for ParsingModel[GraphQLResponse]
__root__ -> errors -> 0 -> type
  field required (type=value_error.missing)
[]

Seems like the error schema has type as a required field but it doesn't hold true in case of syntax errors.

yanyongyu commented 2 weeks ago

Confirm that the type field is missing when syntax error.

In the octokit's issue,

Yes, the type field is going to be returned with every error.

😅 Maybe this case also affects the octokit's error type.