Conversion to snake_case fails on nested inputs
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
調査の方向性
RegisterPlaceInput、PlaceInput、PostalAddressInput の再現から始め、ネストされた InputObjectType 値がどのように変換されるかを追跡します。最深レベルの camelCase 出力を再現し、その後リグレッションカバレッジを追加して、ネストされたすべてのキーが snake_case に変換されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
-
What is the current behavior?
I have double nested inputs, the first two levels are properly converted to snake_case, the third one (deepest) is not. -
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
a github repo, https://repl.it or similar.
import graphene
from django.contrib.auth import get_user_model
from ..models import Place, PostalAddress
User = get_user_model()
class OwnerInput(graphene.InputObjectType):
first_name = graphene.String(required=True)
last_name = graphene.String(required=True)
class PostalAddressInput(graphene.InputObjectType):
street_address = graphene.String(required=True)
address_locality = graphene.String(required=True)
address_region = graphene.String(required=True)
postal_code = graphene.String(required=True)
address_country = graphene.String(required=True)
class PlaceInput(graphene.InputObjectType):
latitude = graphene.Float(required=True)
longitude = graphene.Float(required=True)
postal_address = graphene.Field(PostalAddressInput, required=True)
class RegisterPlaceInput(graphene.InputObjectType):
owner = graphene.Field(OwnerInput, required=True)
place = graphene.Field(PlaceInput, required=True)
class RegisterPlaceMutation(graphene.Mutation):
class Arguments:
input = graphene.Argument(RegisterPlaceInput, required=True)
success = graphene.Boolean(
description="Indicates whether the operation was successful."
)
def mutate(root, info, input):
print(input)
owner_data = input['owner'] #Converted to snake
place_data = input['place'] #converted to snake at the lower level
postal_address_data = place_data['postal_address'] # remains camel
postal_address = PostalAddress.objects.create(**postal_address_data) #fails as data not in the right shape
place = Place.objects.create(
latitude=place_data['latitude'],
longitude=place_data['longitude'],
postal_address=postal_address,
)
return RegisterPlaceMutation(success=True)
class Mutation(graphene.ObjectType):
register_place = RegisterPlaceMutation.Field()
print gives :
>> {'owner': {'first_name': 'JOHN', 'last_name
': 'DOE'}, 'place': {'latitude': 48.9230953, 'longitude': 2.0303184, 'postal_address': {'streetAddress': 'Skalitzer Strasse 99', 'addressLocality': 'Berlin', 'addressRegion': 'Berlin', 'post
alCode': '10997', 'addressCountry': 'DE'}}}
-
What is the expected behavior?
All nested object keys are converted to snake_case. -
What is the motivation / use case for changing the behavior?
snake_case conversion should be consistent independently of the shape of the input -
Please tell us about your environment:
- Version: 3.3
- Platform: with graphene_django 3.2 - (unsure if it's relevant)
- 主要言語
- Python
- スター
- 8.2k
- フォーク
- 822
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
graphql-python/graphene のほかの issue
-
Tutorial mistakesオープン🐛 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
graphql-python/graphene#1389 · コメント 5 件 · リアクション 2 件 ·
-
✨ enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
graphql-python/graphene#1609 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
graphql-python/graphene#1606 ·
-
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 ·
graphql-python/graphene の issue をすべて見る
似ている issue
-
effort: low prio: low ready
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
digitalfabrik/integreat-cms#4616 ·
メンテナーはふだん 5 日以内に返信
-
bug difficulty:2 good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
MakazhanAlpamys/Soup#1865 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FinanceFlash/unvibecode#233 ·
メンテナーはふだん 1 日以内に返信
-
area: agents area: docs good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openapi/gknowledge#23 ·
-
useless-suppression reported for deprecated-* messages that should be exempt対応中かも @adityasinha-ghub が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
pylint-dev/pylint#11656 ·
メンテナーはふだん 1 日以内に返信