-
Notifications
You must be signed in to change notification settings - Fork 823
Queries do not support multiple inheritance #55
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
Comments
The main reason is:
However I certainly believe we should be able to do this in a good way. class Query1(ObjectType):
class Meta:
abstract = True
all_accounts = relay.ConnectionField(accounts_nodes.Account)
account = relay.NodeField(accounts_nodes.Account)
class Query2(ObjectType):
class Meta:
abstract = True
all_transactions = relay.ConnectionField(accounts_nodes.Transaction)
transaction = relay.NodeField(accounts_nodes.Transaction)
class Query3(ObjectType):
class Meta:
abstract = True
all_users = relay.ConnectionField(accounts_nodes.User)
resolve_all_users = ConnectionResolver(accounts_nodes.User)
class Query(Query1, Query2, Query3):
pass Thoughts? |
I think that looks like a good solution. It like that it has some parity with Django's models. Ideally we wouldn't have to specify that a Query is abstract and things would just work, but given that this is not possible I think this is a good solution. 👍 |
This is an interesting topic. Should each django app have its own schema? Then, how do we prevent name collisions? Should we be prefixing the resources then or should each app be serving its own graphql schema at a different URL? Some of these are subjective, but it would be better if we could give some recommended best practices to the community there. |
Hi, I'm attempting to create this level of abstraction as well. I'm using graphql-sqlalchemy and when I do something like:
I'm getting the following error:
|
don't assume property is not nullable when no "nullable" field on property
…tions Add docs about how to build docs, and add sphinx as docs requirement.
Use Case: splitting out query definition logic into smaller and more manageable files (e.g. in Django app directories)
Something like this will not currently work:
It dies with the following error:
I have also tried:
Which dies with the error:
Presumably because the fields never get initialised?
Anyway, if this is possible I'd love to know how.
The text was updated successfully, but these errors were encountered: