I'm playing with crnk trying to deduce the bits I cannot find in the docs. I will explain my problem on standard crnk example: https://github.com/crnk-project/crnk-framework/tree/master/crnk-integration-examples/spring-boot-example.
There is one-to-many relationship between projects and tasks (the other resources are not relevant). If I understand it correctly (the example uses apparently deprecated opposite
@JsonApiRelation parameter) the owner of the relation is 1Task.project1. I now want to list resources filtered by some properties of their related resources. E.g. this works as expected (leaving some unimportant bits from the response):
GET http://127.0.0.1:8080/api/tasks?filter[project.id]=121
{
"data" : [ {
"id" : "1",
"type" : "tasks",
"links" : {
"self" : "http://127.0.0.1:8080/api/tasks/1"
},
"attributes" : {
"name" : "Create tasks",
"description" : null
},
"relationships" : {
"project" : {
"data" : {
"id" : "121",
"type" : "projects"
}
}
} ]
}
But filtering in the opposite direction is not possible:
GET http://127.0.0.1:8080/api/projects?filter[tasks.id]=1
{
"data" : [ ]
}
Is this expected under the setup of the resources (see above link)? If yes what must be done so that filtering works in both directions?