Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw a type error when an attribute is defined on ObjectType which doesn't belong. #15

Open
ckarnell opened this issue Mar 11, 2020 · 1 comment

Comments

@ckarnell
Copy link

Graphene gets mad if you put any attributes on an ObjectType besides Arguments, Fields, resolver methods, and class Meta (and maybe some more stuff I don't know about).

Since defining another type of attribute on an ObjectType throws a runtime error, it would be useful if it threw one at compile time as well.

@minznerjosh
Copy link
Contributor

Is this actually true? I know I can define non-resolver methods on an ObjectType, for instance.

I'd be surprised if something like this wasn't allowed:

class MyType(ObjectType):
    my_field = Field(String)  # we need at least one field

    foo_bar = 'baz'  # I bet graphene is fine with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants