Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants