Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Automatically infer Type of Queries

オープン
#373 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
api

調査の方向性

まず、名前が挙げられている .select()、DSLQuery、dsl_gql のエントリーポイントを追跡し、現在スキーマの戻り値型がどのように扱われているかを理解します。要求されている countries/name とネストされた continent/name の例を既存の選択動作と比較し、そのうえでスカラー選択とオブジェクト選択に対して期待される生成済み GraphQL を定義してテストします。

索引モデルが issue の本文から書いたものです。

説明

type: feature

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

graphql-python/gql のほかの issue

graphql-python/gql の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。