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

Support OneOf input object types

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
api

調査の方向性

Start at InputObjectType metadata handling and schema construction, then trace how GraphQLInputObjectType is created from the declared Meta options. Check graphql-core's is_one_of support and verify that the completed integration exposes isOneOf through introspection and enforces exactly one non-null member during input coercion.

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

説明

Is your feature request related to a problem? Please describe.

Graphene cannot currently express a GraphQL OneOf input object. This commonly arises when an input accepts one of several typed alternatives: defining every alternative as an optional field neither communicates the exactly-one constraint through the schema nor lets GraphQL enforce it during input coercion.

Related requests for input unions or heterogeneous input types have appeared in #721, #797, and #1228. PR #1342 proposed resolver-level validation for a similar exactly-one constraint, but that does not expose the constraint in the GraphQL type system.

Describe the solution you'd like

Allow an InputObjectType to opt into OneOf semantics through its metadata:

class PetInput(graphene.InputObjectType):
    class Meta:
        one_of = True

    cat = graphene.InputField(CatInput)
    dog = graphene.InputField(DogInput)

Graphene would pass this metadata through to graphql-core as GraphQLInputObjectType(is_one_of=True). graphql-core can then expose isOneOf through introspection and enforce OneOf schema and input-coercion rules, including requiring exactly one non-null member value.

Describe alternatives you've considered

Applications can validate optional fields in resolvers or use a custom decorator like the approach proposed in #1342. Those approaches duplicate validation, run later than GraphQL input coercion, and do not make the constraint visible to clients through schema introspection.

Additional context

OneOf input objects are now part of the GraphQL specification, and current graphql-core releases already provide the underlying is_one_of support. Graphene needs a public declaration mechanism and schema-construction integration to expose it.

主要言語
Python
スター
8.2k
フォーク
818
PR マージ指標
30日以内にマージされた PR はありません

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

graphql-python/graphene のほかの issue

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

似ている issue

Python の issue をもっと見る

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

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