Support OneOf input object types
まだ誰も着手していません。
評価
調査の方向性
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 はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
graphql-python/graphene のほかの issue
-
Tutorial mistakes オープン🐛 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
graphql-python/graphene#1389 · コメント 5 件 · リアクション 2 件 ·
-
Python 3.14 support オープン✨ enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
graphql-python/graphene#1601 · コメント 2 件 ·
-
✨ enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
graphql-python/graphene#1600 ·
-
🐛 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
graphql-python/graphene#1593 ·
-
🐛 bug
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
graphql-python/graphene#1592 ·
graphql-python/graphene の 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 ·