You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@strawberry.type
class Person():
id: int
name: str
PyRight throws an error on Person(3, "Rob"): Expected no arguments to Person Constructor. The way to get around this is to create an __init__ function. However, when classes are decorated with @strawberry.type the fields within the Strawberry type cannot be selected. If an __init__ is provided, the following gql requests will fail
person {
id
name
}
With AttributeError: 'Person' object has no attribute 'id'. What is the preferred way to create initializers for Strawberry Types?
The text was updated successfully, but these errors were encountered:
patrick91
changed the title
@strawberry.type constructor type error
Type checking support for PyRight
Aug 9, 2021
Hi,
Given the following type
PyRight throws an error on
Person(3, "Rob")
:Expected no arguments to Person Constructor
. The way to get around this is to create an__init__
function. However, when classes are decorated with @strawberry.type the fields within the Strawberry type cannot be selected. If an__init__
is provided, the following gql requests will failWith
AttributeError: 'Person' object has no attribute 'id'
. What is the preferred way to create initializers for Strawberry Types?The text was updated successfully, but these errors were encountered: