graphql-python / graphql-python/graphql-core-legacy
Parser raises an error for null Boolean Type
- 主要言語
- Python
- スター
- 372
- フォーク
- 175
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
The parser is not able to handle boolean types with `null` default type.
This is handled in this line: https://github.com/graphql-python/graphql-core-legacy/blob/master/graphql/language/parser.py#L502
Following a [commit](https://github.com/octokit/graphql-schema/commit/18c40d2bb68d8f27acfc62e768d34aadfca9e8b2#diff-9fcde326d127f74194f70e563bdf2c118c51b719c308f015b8eb0204a9a552fb) GitHub introduced to their schema yesterday `gql` can no longer parse its schema, as it fails on this `null` `Boolean` type:
```
{'name': 'isVerified', 'description': 'Filter by if the domain is verified.', 'type': {'kind': 'SCALAR', 'name': 'Boolean', 'ofType': None}, 'defaultValue': 'null'}
```
GitHub claims this change is in accordance with the [GraphQL standards documentation](https://graphql.org/graphql-js/basic-types/):
> By default, every type is nullable - it's legitimate to return null as any of the scalar types. Use an exclamation point to indicate a type cannot be nullable, so String! is a non-nullable string.
> Therefore, it appears that a null default value for a boolean is valid in GraphQL.
Currently the code specifically ignores `null` values.

コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start at graphql/language/parser.py line 502, where null values are currently ignored, and reproduce the failure with the Boolean schema entry shown in the issue. Update the parser behavior so a nullable Boolean with a null default is accepted, then verify that the GitHub schema example parses without raising an error.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 68/100