Open thclark opened 5 months ago
Hrm, I get what you mean here from a new user perspective, specially for someone new to strawberry that usually don't know that Query
and Mutation
are types as well.
I somewhat like this proposal, but I'm not totally sure it brings value enough instead of improving the documentation and ensuring the user knows the difference between strawberry_django.type
and strawberry.type
.
What do you think about this @patrick91 ?
I'm -1 for this 😊
A GraphQL Query type is a standard type, what makes it special is it being set on strawberry.Schema
, I understand that might be confusing and we should make it less confusing maybe with docs, but I don't think a new decorator will make it less confusing
OK, so -2 on renaming the decorator.
We could elaborate in the docs that Queries
and Mutations
are also types and that's why they're wrapped in a type decorator, but still using the type decorator from a different, underlying, library is definitely a point of hangup for new users.
Could it work to simply use @strawberry_django.type()
with no model argument?
We could elaborate in the docs that Queries and Mutations are also types and that's why they're wrapped in a type decorator, but still using the type decorator from a different, underlying, library is definitely a point of hangup for new users.
I do agree that Query
and Mutation
also being types is a source of confusion between users. It took myself some time to understand this as well back when I started working with graphene =P
Maybe we could acomplish this by adding docs on strawberry
itself? Specially because we are soon going to display strawberry-django
's docs as a subsection of strawberry docs, which might help alleviating the confusion.
Could it work to simply use @strawberry_django.type() with no model argument?
We would need to change strawberry_django.type()
to allow it to not receive a model argument, but I would be against it as that would mean we would not be able to enforce typing on it correctly anymore.
Feature Request Type
Description
When I was working with the documentation improvements the other week, one area where I realised I was struggling was the difference between
@strawberry.type
and@strawberry_django.type
.See my comments in the code below (extracted from that featured in the docs):
Proposed Solution
What about, within
strawberry-django
, we do:Then the last section of the code above looks like:
I think this solution has the following benefits:
strawberry_django
to avoid digging immediately into the much bigger and more complex strawberry docsEffort required
Less than an hour. I'm happy to make this PR myself and update documentation to match if my suggestion has the blessing of the maintainers, no breaking changes required.
Upvote & Fund