question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filter by id of the related resource

See original GitHub issue

Hello,

I have a resource X, which has 1-to-many relationship to resource Y. I try to get only that ones of type X, which are related to Y with certain id. Filtering with

http://$host:8080/ui-api/X?include=Y&filter[X][Y.id]=id

delivers no entries. Debugging showed to me, that the filter is trying to access the related objects Collection, and at the filtering moment the related objects are not loaded from their ids.

Is it possible to use for filtering just the ids from the @JsonApiRelationId Collection, without loading all related objects?

Thanks Best regards Andre

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
remmeiercommented, Nov 13, 2019

There is InMemoryEvaluator.getPRoperty which looks up the value for a given attribute path. What you suggest is already implemented. However, for this to work in needs access to the ResourceRegistry. This can be done by creating the InMemoryEvaluator manually rather than simply using QuerySpec.apply. There is a simple heuristic in place in case of a missing ResourceRegistry. Would also be a possiblity to make that one a bit more advanced by looking for @JsonApiRelation and @JsonApiId annotations.

0reactions
aawakencommented, Nov 14, 2019

Thanks, I’ll check it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

List and filter your resources - Amazon Elastic Compute Cloud
Filter resources using the console · In the navigation pane, select a resource type (for example, Instances). · Choose the search field. ·...
Read more >
Filtering the Output by Resource ID - Informatica Documentation
You can enter a resource ID to select output data by key values. The resource ID is the key that you selected when...
Read more >
REST API: resource needs to be filtered by ID, but no ID ...
The $filter querystring parameter allows clients to filter a collection of resources that are addressed by a request URL.
Read more >
To Filter Users By ID - MuleSoft Help Center
To Filter Users By ID. I want to filer the get result by ID. Is it possible in Any-point Platform ? Below is...
Read more >
Enable Service Resource Filtering - Salesforce Help
Use the Filter by Resource IDs attribute on relevant flow pages to specify a comma-separated list of service resource IDs. Salesforce Scheduler limits...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found