`~all` or `*` should work in `fields` too
See original GitHub issueHey there! I was looking at graphql until I found you awesome library, thank you! I don’t have to add another yet API 🗡️
The question is: We have two models with a lot of fields, e.g
class Order:
field0 = ....
field1 = ...
...
field35 = ...
restaurant=Restaurant
class Restaurant:
field0 = ...
field1 = ...
...
field60 = ....
And I want to make a request that will get All fields from Order, expand Restaurant, but only field0\field1 How can I achieve it with drf-flex?
I tried to solve it these ways:
GET /orders/?expand=restaurant
- but it gives too much fields, I really want to only two from Restaurant because we have about 100 orders in a list and all of them will contain 60 additional fieldsGET /orders/?fields=field0,field1,...,field35,restaurant.field0,restaurant.field1&expand=restaurant
- In this case I get that I want to, but I have to add all of fields to params, and I really don’t want to do it on the frontend 😃GET /orders/?expand=restaurant
- give me too much fields too
What I really want to can be achieved with GET /orders/?fields=~all,restaurant.field0, restaurant.field2&expand=restaurant
But looks like ~all
works only in expand
and not on fields
, right?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Is it better to specialize in one field or to work at ... - Quora
The answer should carry one of my live experience. When I was in my college days and was pursuing my commerce graduation, I...
Read more >Should You Explore Fields & Career Interests Outside Your ...
It's okay to engage in other fields and interests. You don't need to be tied down to one profession just because you've worked...
Read more >Embrace Your Paths: Why Having Multiple Jobs is a Good Thing
You Can Go Global If you're interested in working around the world, having a multitude of skills in different fields can not only...
Read more >Should You Take a Job That's Not in Your Chosen Field?
You enter college, choose a major, and then work in your chosen field when you graduate. But these days it's not so straightforward....
Read more >Explore These 13 Career Fields | Indeed.com
Knowing the various career fields will help you be able to choose the right job based on your talents, education and interests. In...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I finally had a change to update the library in production and test the new feature. It works!
Thank you a lot for supporting such a great project! 😃
I see your point here and agree this should should work the way you describe. I think it should go further and allow specifying all fields at nested levels, eg
fields=restaurant.*
. Hopefully I’ll get to this in the next few weeks. I appreciate the useful suggestion.