Closed polc closed 4 years ago
Just use /persons?orderBy=name
vulcain acts as a reverse proxy it'll work
My problem is about passing params to deep resources, I realized the issue was not very clear so I updated the example.
I don't see the issue it should work just like this
Sorry the previous requests were missing the query params I wanted to show :
GET /persons?orderBy=name&starships[type]=destroyer&starships.weapons[category]=nuclear
Preload: /*/starships/*/weapons
[
{
"id": "/persons/1",
"name": "Person 1",
"starships": "/starships?person=/persons/1&type=destroyer&weapons[category]=nuclear"
}
]
GET /starships?person=/persons/1&type=destroyer&weapons[category]=nuclear
[
{
"id": "/starships/1",
"name": "Starship 1",
"weapons": "/weapons?starship=/startships/1&category=nuclear"
}
]
GET /weapons?starship=/startships/1&category=nuclear
[
{
"id": "/weapons/1",
"name": "Weapon 1",
}
]
Here, to pass query params deeper, I add them to the root resource. Even if it's not a big problem, I see 2 minor inconveniences :
explosives
, the whole graph of resource will change (less cache).Is this the recommended way of passing query params?
There is a mention about using GraphQL as a query language for Vulcain here : https://github.com/dunglas/vulcain/blob/master/docs/graphql.md#using-graphql-as-query-language-for-vulcain
I've been playing on a toyproject about Vulcain and I'm wondering if all GraphQL queries can be converted to a HTTP Request using Vulcain, and especially, deep arguments like the following :
Given this query
I believe it may be translated to the following requests :
Now It's easy to change
weapons(category: nuclear)
toweapons(category: explosives)
in GraphQL, but I'm not sure how to do it with Vulcain. Do you have any insight about this problem?