Python 无法解析石墨烯中带下划线的字段名
我研究了Python的石墨烯,它成功了。这是密码-Python 无法解析石墨烯中带下划线的字段名,python,graphql,graphene-python,Python,Graphql,Graphene Python,我研究了Python的石墨烯,它成功了。这是密码- from graphene import ObjectType, String, Schema class Query(ObjectType): hello = String(name=String(default_value="stranger")) def resolve_hello(root, info, name): return f'Hello {name}!' schema = Schema
from graphene import ObjectType, String, Schema
class Query(ObjectType):
hello = String(name=String(default_value="stranger"))
def resolve_hello(root, info, name):
return f'Hello {name}!'
schema = Schema(query=Query)
query = '{ hello(name: "GraphQL") }'
result = schema.execute(query)
print(result.data['hello']) # "Hello GraphQL!"
但是,在将hello
更改为某些字段
,并将解析hello
更改为解析某些字段
,并进行查询='{some字段(名称:“GraphQL”}'
,我得到的最终结果是无
有没有办法处理包含下划线的字段?我不知道幕后的石墨烯是如何将蛇壳转换成骆驼壳的 模式定义中的一切都很完美,但我将其称为客户机的方式需要改变 因此,不是:
query='{some_字段(名称:“GraphQL”}'
…我需要做:
query='{someField(名称:“GraphQL”}'
…因为客户端JavaScript更喜欢这样称呼它