Automatically infer Type of Queries
まだ誰も着手していません。
評価
調査の方向性
まず、名前が挙げられている .select()、DSLQuery、dsl_gql のエントリーポイントを追跡し、現在スキーマの戻り値型がどのように扱われているかを理解します。要求されている countries/name とネストされた continent/name の例を既存の選択動作と比較し、そのうえでスカラー選択とオブジェクト選択に対して期待される生成済み GraphQL を定義してテストします。
索引モデルが issue の本文から書いたものです。
説明
For the following query on https://countries.trevorblades.com/
query GetCountries {
countries {
name
}
}
The snippet to generate this dynamically using gql is:
dsl_gql(
GetCountries=DSLQuery(
ds.Query.countries.select(ds.Country.name)
)
)
Notice that in the raw graphql I just mentioned name instead of Country.name. As the schema already lays out the return types of all queries, graphql is able to figure it out automatically.
""" schema.graphql """
type Query {
...
countries(filter: CountryFilterInput): [Country!]!
...
}
type Country {
...
name: String!
...
}
Would it be possible to modify .select() to auto-select objects of the query type by their name?
Maybe something like:
dsl_gql(
GetCountries=DSLQuery(
ds.Query.countries.select("name", DSLAutoSelectable("continent").select("name"))
)
)
Resulting graphql
query GetCountries {
countries {
name
continent {
name
}
}
}
Note: The sgqlc library has a __fields__() method which can get the immediate scalars by name: https://github.com/profusion/sgqlc/blob/465a5e800f8b408ceafe25cde45ee0bde4912482/sgqlc/operation/__init__.py#L390
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 195
- 平均マージ
- 14分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
graphql-python/gql のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
graphql-python/gql#613 · コメント 2 件 ·
-
type: feature
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
graphql-python/gql#434 ·
-
type: feature
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
graphql-python/gql#355 · コメント 1 件 ·
-
type: feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
graphql-python/gql#316 · コメント 5 件 · リアクション 3 件 ·
graphql-python/gql の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
huggingface/Repo2RLEnv#163 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
NousResearch/hermes-agent#121143 ·