-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
Take the following example, adapted from the README:
import uuid
import graphene
import pydantic
from graphene_pydantic import PydanticInputObjectType, PydanticObjectType
class PersonModel(pydantic.BaseModel):
id: uuid.UUID
first_name: str
last_name: str
class PersonInput(PydanticInputObjectType):
class Meta:
model = PersonModel
exclude_fields = ("id",)
class CreatePerson(graphene.Mutation):
class Arguments:
person = PersonInput()
@staticmethod
def mutate(parent, info, person: PersonInput): # I'd like to type hint this argument
personModel = PersonModel(
id=uuid.uuid4(),
first_name=person.first_name,
last_name=person.last_name
)
return person
It would be nice to be able to type hint the model properties that are defined on the InputObjectType
through introspection. Currently, the mutate
method generates type warnings:
lovetoburnswhen
Metadata
Metadata
Assignees
Labels
No labels