graphql-python / graphql-python/graphene
Is it possible to dynamically create InputObjectType objects ?
- 主要言語
- Python
- スター
- 8.2k
- フォーク
- 818
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
My problem: I have a method foo that takes an InputObjectType as input and does some logic, from those InputObjectType, I need to create, dynamically in the backend, other InputObjectType that will also be passed to the foo method.
When I try to create the InputObjectType, I get a type String is not json serializable error.
Is what am saying possible ? or should refactor my foo method to take dicts or something else ?
```python
def foo(input: SomeInputObjectType):
some_logic(input.some_attribute)
def mutate(..., input1):
# I want to create object input2 that can be passed to the foo method along with input1
# input2 = InputObjectType(...)
foo(input1)
foo(input2)
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Graphene の InputObjectType の動作と、issue に示されている foo および mutate のエントリポイントから始めてください。提案されている動的に作成された input で String is not JSON serializable エラーを再現し、その後、構築がサポートされているのか、それとも foo の境界で別の表現を受け入れる必要があるのかを判断してください。サポートされているアプローチまたは必要なリファクタリングが文書化され、検証されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api, backend-api-design
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100