strawberry-graphql / strawberry-django

Strawberry GraphQL Django extension
https://strawberry.rocks/docs/django
MIT License
404 stars 117 forks source link

Ordering not in schema when passing via decorator #96

Closed jaydensmith closed 1 year ago

jaydensmith commented 2 years ago

In the example you can pass order into the Django type decorator, the result however has the order argument missing from the schema. Filter and pagination work fine.

https://github.com/strawberry-graphql/strawberry-graphql-django/blob/674c7b914611e0cc798d0b9480a207220b2d3433/examples/django/app/types.py#L46-L52

Currently I am working around this by defining the order at the field definition:


@strawberry.type
class Query:
    fruits: List[Fruit] = strawberry_django.field(
        filters=FruitFilter,
        order=FruitOrder,
        pagination=True
    )

<!-- POLAR PLEDGE BADGE START -->
## Upvote & Fund

- We're using [Polar.sh](https://polar.sh/strawberry-graphql) so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.

<a href="https://polar.sh/strawberry-graphql/strawberry-graphql-django/issues/96">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/strawberry-graphql/strawberry-graphql-django/issues/96/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/strawberry-graphql/strawberry-graphql-django/issues/96/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->
andrej-vasilj commented 2 years ago

I ran into this bug as well. Given that the documentation states that filtering, pagination and ordering are working and all of the examples define ordering via the decorator I would say it's a fairly big/high-priority bug...

bellini666 commented 1 year ago

Fixed by https://github.com/strawberry-graphql/strawberry-graphql-django/pull/176